Yuyu Zon
Yuyu Zon

Reputation: 25

get page id from title with wiki api none english

I want get page id from wiki api vietnamese but when i try with url

https://en.wikipedia.org/w/api.php?action=query&titles=Trung%20%C4%90%C3%B4ng&prop=iwlinks&format=json

It can't show any thing

{"batchcomplete":"","query":{"pages":{"-1":{"ns":0,"title":"Trung \u0110\u00f4ng","missing":""}}}}

but when i use autosuggest in https://vi.wikipedia.org with link api

https://vi.wikipedia.org/w/api.php?action=opensearch&format=json&formatversion=2&search=Trung%20Đông&namespace=0&limit=10&suggest=true

Very lot result showing. How can I use action=query to get pageid with title on wiki vietnamese?

Upvotes: 1

Views: 202

Answers (1)

Ainali
Ainali

Reputation: 1631

You are making the request to English Wikipedia instead of Vietnamese. Change the en to vi in your call and you will get results. See here:

https://vi.wikipedia.org/w/api.php?action=query&titles=Trung%20%C4%90%C3%B4ng&prop=iwlinks&format=json

Upvotes: 1

Related Questions