I see, thanks a lot!!

2016-09-11 22:36 GMT+08:00 Bartosz Dziewoński <matma.rex@gmail.com>:
This works: ("Pirin" is just a random page with some broken links)

https://en.wikipedia.org/w/api.php?action=query&format=json&titles=Pirin&generator=links&formatversion=2&gpllimit=500

https://en.wikipedia.org/wiki/Special:ApiSandbox#action=query&format=json&titles=Pirin&generator=links&formatversion=2&gpllimit=500

This gives you a list of all links on a page; you need to parse the JSON data and count how many entries have `"missing": true`.

Note that if there are more than 500 links on a page, you'll need to continue the query to get the full list (https://www.mediawiki.org/wiki/API:Query#Continuing_queries). It seems that conveniently all the broken links are listed first, but I'm not sure if this can be relied on.

--
Bartosz Dziewoński

_______________________________________________
Mediawiki-api mailing list
Mediawiki-api@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-api



--

Zhang Shiyue

Tel: +86 18801167900

E-mail: byryuer@gmail.com, yuer3677@163.com

State Key Laboratory of Networking and Switching Technology

No.10 Xitucheng Road, Haidian District

Beijing University of Posts and Telecommunications

Beijing, China.