您如何获取包含可用格式的链接的文章? [英] How do you grab an article including the links in a usable format?

查看:74
本文介绍了您如何获取包含可用格式的链接的文章?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在内部部署了mediawiki.在某些文章中有外部链接.我有另一个页面,该页面对Wiki进行API调用,以将文章拉入另一个网站.当我拉入那些文章时,链接不会被正确拉入.这是一个例子.

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文章:

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结果:

Use THIS LINK to contact the vendor.

请注意,链接已完全断开.我还尝试将我自己的html添加到mediawiki中以获取链接,但是mediawiki转义了<.和>符号,因此API会显示'& lt'和'& gt'.此外,mediawiki显示的是html,而不是实际的链接.

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.

如何进行MediaWiki API调用并保留链接信息?

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

推荐答案

为此,您可以改用action=parse.查询如下所示:

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

这篇关于您如何获取包含可用格式的链接的文章?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆