We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Udemy.com is blocking the default User Agent of opengraph.
I'm getting
How do I set a custom user agent for OpenGraph module
urllib2.HTTPError: HTTP Error 403: Unauthorized
As a workaround I have created a custom getter using requests module
def custom_get_img_from_link(link): """ """ #headers = {"User-Agent":get_random_UA()} headers = {"User-Agent": "My bot"} r = requests.get(link, headers=headers) parsed_uri = urlparse(link) domain = '{uri.scheme}://{uri.netloc}/'.format(uri=parsed_uri) OpenGraph.parser = parser OpenGraph.scrape = True # workaround for some subtle bug in opengraph page = OpenGraph(html=r.content) if page.is_valid(): image_url = page.get('image', None) if not image_url.startswith('http'): image_url = urljoin(domain, page['image']) return image_url
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Udemy.com is blocking the default User Agent of opengraph.
I'm getting
How do I set a custom user agent for OpenGraph module
As a workaround I have created a custom getter using requests module
The text was updated successfully, but these errors were encountered: