Raureif/WikipediaKit

Retrieve all images of an Article

markvillar opened this issue ยท 3 comments

Hi Frank,

Is there any way to retrieve all images of a single article?

Inspecting both ArticlePreview and WikipediaArticle classes tells me that objects of these types would only return one image URL per article?

though I am under the impression that it is possible to get multiple images as witnessed in V for Wiki app (elegantly designed btw ๐Ÿ‘).

Hi Mark,

thanks! Glad you like V for Wiki.

I think I tried retrieving all article images from the API but gave up. ๐Ÿ˜…

How I made it work in the app: I ask the WKWebView that displays the article via JavaScript to return all zoomable images. It works fast and reliably with the JS/native bridging stuff. Not elegant, but it makes sense for my use case because not every <img> tag in the article HTML qualifies as a content image (think icons and hacky table templates, for example).

If you find a straightforward (non-hacky) way to get all images from the API, please let me know or create a PR. Thanks.

Best,
Frank

Hello! I work for the Wikimedia Foundation on the Wikipedia for iOS and Android apps. There's a recently created API for requesting all the media on a given page. Feedback and feature requests are welcome via this Phabricator board. Hope this helps!

Thanks, @joewalsh! This is great news.