How do you grab an article including the links in a usable format?

℡╲_俬逩灬. 提交于 2020-01-15 07:04:39

问题


I have an internal deployment of mediawiki. In some articles are external links. I have another page that makes API calls to the wiki to pull articles into another website. When I pull those articles in, links do not get pulled in properly. Here is an example.

Wiki article:

Use [http://example.com THIS LINK] to contact the vendor.

API URL:

https://mysite.com/mediawiki/api.php?action=query&format=json&prop=extracts&titles=Vendor

API results:

Use THIS LINK to contact the vendor.

Notice the link is completely stripped away. I've also tried to add my own html into mediawiki for links but mediawiki escapes < and > symbols and so the API see's '&lt' and '&gt'. Also mediawiki displays html and not an actual link.

How do I make mediawiki API calls and keep link information?


回答1:


For this, you can use action=parse instead. The query would look like this:

https://mysite.com/mediawiki/api.php?action=parse&format=json&page=Vendor&prop=text


来源:https://stackoverflow.com/questions/16067832/how-do-you-grab-an-article-including-the-links-in-a-usable-format

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!