有办法从维基百科 XML 文件中删除内部链接吗?
如果我已经下载了 Wikipedia XML 转储,是否有任何方法可以从 XML 文件中删除所有内部链接?
谢谢
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
如果我已经下载了 Wikipedia XML 转储,是否有任何方法可以从 XML 文件中删除所有内部链接?
谢谢
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(4)
如果您要将它们导入本地 wiki,您可以做的一件事是导入您想要的所有文件,然后使用机器人(例如 pywikipediabot 很容易使用)来摆脱所有内部链接。
One thing you could do, if you are importing them into a local wiki, is to import all the files you want, then use a robot (eg. pywikipediabot is easy to use) to get rid of all the internal links.
维基百科数据库转储和有关使用它们的信息位于此处:维基百科:数据库下载。 您应该这样做,而不是编写脚本来抓取维基百科。
Wikipedia database dumps and information about using them are located here: Wikipedia:Database download. You should do this instead of writing a script to scrape Wikipedia.
我会尝试使用 XSLT 将 XML 文件转换为另一个 XML 文件。
I would try to use XSLT to transform the XML file into another XML file.
您可以在您最喜欢的文本编辑器中进行搜索和替换,将 [[ 和 ]] 替换为空。
You could do a search and replace in your favorite text editor, replacing [[ and ]] with nothing.