2

I'm trying to search WikiNews, both for specific news stories and for the latest headlines. I've been reading about the MediaWiki API (https://www.mediawiki.org/wiki/API:Main_page), but it doesn't seem to map to what I'm trying to do.

Taking two examples, I need to be able to get the latest headlines (ideally for a specific region (United States, France, Great Britain etc) and for a specific topic (Finance, Sport, Media etc), but right now I'd settle for just getting the latest stories regardless. I've tried a couple of things:

  1. https://en.wikinews.org/w/api.php?action=query&prop=categories&clprop=timestamp&format=json just returns batchcomplete
  2. http://en.wikinews.org/w/api.php?action=query&list=recentchanges&rnnamespace=0 looks like it might be more promising, but only if I could filter only to show news stories - and show a good deal more than it currently does. Clearly it would also be desirable to add parameters for location / story type in the query rather than filtering them after the list is received.

With regard to searching, I've had even less luck. I've tried searching on a topic that I know is ~~causing trouble~~ making the news:

  1. https://en.wikinews.org/w/api.php?action=query&titles=Donald_Trump&prop=revisions&rvprop=content&format=json&redirects&continue the return is not a list of stories!

Has anyone searched WikiNews? Does anyone have any suggestions to achieve what I need to do?

headbanger
  • 1,038
  • 1
  • 11
  • 32
  • The search API endpoints are [search](https://www.mediawiki.org/wiki/API:Search), [geosearch](https://www.mediawiki.org/wiki/Extension:GeoData#API) and [opensearch](https://www.mediawiki.org/wiki/API:Opensearch) (see [API:Search and discovery](https://www.mediawiki.org/wiki/API:Search_and_discovery) for an overview). I don't think you can search for recent events. MediaWiki hasn't been adapted much to the needs of WikiNews. – Tgr Aug 22 '16 at 10:34
  • Damn. Do you know of anything which might work better, whilst still providing open and free content? – headbanger Aug 23 '16 at 12:58
  • I don't. You can probably put a recent article search together for Wikinews (e.g. use [date category](https://en.wikinews.org/wiki/Category:News_articles_by_date) intersections) but it will take some effort. – Tgr Aug 23 '16 at 22:15
  • Hmm. Any suggestions? Or has anyone else any suggestions (put 'em in an answer so that I can give a tick and up vote!) – headbanger Aug 25 '16 at 13:35
  • @headbanger Have you found a way to get the latest headlines from Wikinews? – Antonín Slejška Nov 19 '18 at 10:00

1 Answers1

2

action=query&format=json&list=search&redirects=1&srsearch="Donald Trump" -incategory:disputed incategory:"August_25, _2016|August_24,_2016|August_23,_2016|August_22,_2016|August_21,_2016|August_20,_2016|August_19,_2016|August_18,_2016"&srnamespace=0&srenablerewrites=1 will search for articles from the last few days mentioning Trump. (See full docs on what keywords can be used in a search query.)

Most of your examples do not actually generate a list (you can see from the lack of a list parameter); they expect one or more article name via the titles parameter and return information about those. Your second example is valid (except the correct parameter name is rcnamespace) but that returns recently edited articles, which is a very random way of trying to find news on a topic.

In general it seems like you are trying to randomly guess what the API modules do. Did you miss the docs and sandbox?

Tgr
  • 27,442
  • 12
  • 81
  • 118
  • Thanks for this - that's a huge help. I really didn't understand the docs (on the basis of the attempts I made above!) – headbanger Aug 26 '16 at 08:13