How do you grab an article including the links in

2019-07-10 03:50发布

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条回答
闹够了就滚
2楼-- · 2019-07-10 04:13

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
查看更多
登录 后发表回答