Getting a list of all URLs redirecting to a Wikipedia page?

时间:2016-07-11 20:41:29

标签: mediawiki wikipedia wikipedia-api

I need to know all the different URLs that lead to the same end Wikipedia article URL for a project I'm doing. For example:

https://en.wikipedia.org/wiki/Lucite

redirects to the final URL:

https://en.wikipedia.org/wiki/Poly(methyl_methacrylate)

However, I'm not sure how many other URLs also redirect to the final URL of that page, times this issue for every other Wikipedia article. Is there a specific API call I'm not seeing that you can send a final page_name/URL, and it returns a JSON of all the name/URLs that redirect to the final URL? I really need something like this if it exists. For reference, I already looked, and I'm aware of the fact that you can perform two API calls for all pages like this:

https://en.wikipedia.org/w/api.php?action=query&generator=allpages&format=json&gaplimit=500&gapfilterredir=nonredirects

then the one that is nonfiltering of redirects

https://en.wikipedia.org/w/api.php?action=query&generator=allpages&format=json&gaplimit=500&

I understand that you can take the disjoint of these two sets and those are redirecting URLs, and that you can do it ad infinitum for all pages and find all redirecting names/URLs, but it would save me on my project exponential time if I could simply find a way to send a URL to Wikipeidia's API and somehow get a list of all URLs leading back to that final page URL. Thank you in advance!

1 个答案:

答案 0 :(得分:3)

相关问题