I want to search Wikipedia using the query
action. I am using this url:
http://en.wikipedia.org/w/api.php?action=query&format=json&list=search&srsearch=apple
That works but I want to get into the first result of the search. How can I do that?
Note: That url works fine when there is only one result.. I just need the title and some short description.
actually the wikipedia json api works with a right query only, so I recommend to use the wikipedia search and crawl the actual article and parse it with BeautifulSoup
https://en.wikipedia.org/w/index.php?search=QUERY&title=Special:Search&fulltext=Search
and also there is module call wikipedia does this for you
Here is the my solution:
I don't think you can do both in one query.
1. To get the first result, use the Opensearch API.
https://en.wikipedia.org/w/api.php?action=opensearch&search=zyz&limit=1&namespace=0&format=jsonfm
This will return:
2. You now have the article name of the first search result. To get the article's first paragram (or description, as you call it), see my answer here: https://stackoverflow.com/a/19781754/908703