Skip to content

Is it possible to get the image preview that an article uses? #107

Answered by barrust
luni3359 asked this question in Q&A
Discussion options

You must be logged in to vote

After looking a bit at the docs this morning I found a JSON Endpoint that would likely do what you are looking for. There are some portions of this project that attempts to parse the HTML page (logos, hatnotes, and parse_section_links)

The following code could be used to simulate what I think you are asking:

import requests

url = 'https://en.wikipedia.org/api/rest_v1/page/summary/Dog'
r = requests.get(url)
print(r.text)

If this is what you are looking for, then perhaps this could be added. It isn't exactly the same API and something would need to be done to check if it is available (since this library supports more than just Wikipedia!) but it could be useful.

Hope this helps!

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@luni3359
Comment options

@barrust
Comment options

@luni3359
Comment options

@barrust
Comment options

@luni3359
Comment options

Answer selected by luni3359
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants