WikiMedia API: How to GET a List of Articles by Category and Location? - api

Assuming I would like to get a list of 5 articles that are belonging to the "Cathedrals in Paris" category AND are nearby my location (Lat=48.8,Lon=2.3).
Is there a way to achieve both at the same GET?
If not, what is considered the best practice for achieving this goal? I know I can use the geosearch (or the categorymembers) generator, but then what? loop through each article?
Thanks.

I checked at https://www.mediawiki.org/ and well, the simple answer is no.
The best option is to search by location OR by category (preferably the option that returns LESS results), and then loop through each article.

Related

How to retrieve all wikipedia articles containing at least one table?

The API doesn't seem to be very clear in how to retrieve all articles containing a "wikitable" class.
What's the best way to do this?
Probably because there is no such API. You can try searching for class="wikitable".
Tables are unstructured and can appear in unexpected places, such as manually aligning images. You can try the searching insource:" class=wikitable", as Tgr suggests.

Fetching all pictures of certain artist on mediawiki

Currently I'm looking for a way to fetch URLs of paintings on mediawiki that is authored by Albrecht Durer.
Can you point me to a some explanations, is there any API like "give me all images where artist is Albrecht Durer"?
I have found an imageinfo (http://www.mediawiki.org/wiki/API:Properties#imageinfo_.2F_ii), but didn't find how to filter by artist.
There isn't a great way to do that. The structured media data project aims at providing exactly this kind of capability, but it is still ways off.
Right now, your best bet is using the category system. Category:Paintings by Albrecht Dürer and its subcategories contain the images you are looking for, and you can use the categorymembers API as a generator for imageinfo to fetch the URL's. There is no way to get a recursive list though, so you will have to recurse into subcategories manually. To make it worse, the category graph is not guaranteed to be a tree, so you will have to implement things like duplicate filtering and cycle detection.
If the wiki in question is Wikimedia Commons, there are various external tools which can help, such as CatScan or catgraph.

MediaWiki api for Wikipedia - is it possible to search by title on ALL languages?

I know that to search for a page id of a wikipedia with known title, i can do:
https://en.wikipedia.org/w/api.php?action=query&titles=7_Studios
However, in this case, 7_Studios is a french wikipedia article, so the above link would not work. Instead I need to try
https://fr.wikipedia.org/w/api.php?action=query&titles=7_Studios
My question is, if I do not know what language the article is about but only the title itself, how can it make sure i can find it using the api?
As Bergi mentioned, you can use Wikidata for this: it contains the database of interwiki links, so it's possible some article title won't be there, but most should.
To do this, you can use the wbgetentities module: you specify the title to search for and a list of wikis to search. For example:
https://www.wikidata.org/w/api.php?action=wbgetentities&titles=7_Studios&sites=enwiki|frwiki|nlwiki|dewiki
You can specify up to 50 wikis in one query. Currently, there are around 300 Wikipedias, so if you really need to query all of them, you may need up to 6 requests for each title.

Counting word occurrences in Wikipedia

Is there any way to use Wikipedia API to count the number of word occurrences in Wikipedia. For example, how many times the word "Hello" appears in Wikipedia? I read the MediaWiki API docs but could not find it there! appreciate any help!
There is no way to get a global word count from the API in a single call. If you are interested in wordcounts, then your best bet would be using the database dumps: http://dumps.wikimedia.org/backup-index.html

Use the Apple Search API to search by genre?

Is it possible to use the Apple Search API to search by genre ? I'm thinking specifically games in the app store. Using Obj-c.
As has been pointed out in the comments of this question...
Search Apple App store by genre with iOS/Obj-c
There seems to be a problem with trying to search by genre, so I'm looking for answers which of examples of that actually working, not just links to the docs.
It's not actually documented on the Search API documentation, but you can add a genreId parameter to the search URL and it restricts the search to a particular genre.
If you look at the JSON returned from a search for "Yelp", there are 4 interesting things:
"genreIds":["6005", "6001"]
"genres":["Social Networking", "Weather"]
"primaryGenreName":"Social Networking"
"primaryGenreId":6005
Adding &genreId=6001 to a URL will find apps in the US in the "Weather" category. I'm using the search term "Check" in the URL.
https://itunes.apple.com/search?term=Check&country=us&entity=software&genreId=6001
Because it's not documented, you can't rely on it working forever. You may also be able to use the primaryGenreName as a parameter, I didn't try that. You'll have to figure out what numbers correspond to what categories too.
The Search API is documented here: http://www.apple.com/itunes/affiliates/resources/documentation/itunes-store-web-service-search-api.html
You can use this link to generate an RSS Feed of your liking. Without knowing too much about how you intend to use it, I would suggest looking at these two solutions and using the best one that suits your needs.