Reputation: 581
i'm using this query to fetch all the langlinks from the english version of wikipedia having title "foo" and it works like a charm
/w/api.php?
action=query&
prop=langlinks&
format=xml&
llurl=&
lllang=it|fr
&titles=foo
but the result is a pain in the *
"query": {
"normalized": [
{
"from": "foo",
"to": "Foo"
}
],
"pages": {
"1234567": {
"pageid": 1234567,
"ns": 0,
"title": "Foo",
"langlinks": [
{
"lang": "it",
"url": "http://it.wikipedia.org/wiki/Foo",
"*": "Foo"
},
{
"lang": "fr",
"url": "http://fr.wikipedia.org/wiki/Foo",
"*": "Foo"
}
]
}
}
what i need here is prop=extracts on those urls both for the italian language and the french language, but without specific pageids for each url i'm not able to achieve that (or at least i don't know how to deal with it)
Upvotes: 2
Views: 514
Reputation: 1631
prop=extracts
works well with titles too. Here is the API calls for your two examples:
https://it.wikipedia.org/w/api.php?action=query&prop=extracts&format=json&exlimit=10&titles=Foo
and
https://fr.wikipedia.org/w/api.php?action=query&prop=extracts&format=json&exlimit=10&titles=Foo
Upvotes: 1