wikipedia - 直接获取维基百科原始标签?
问题描述
是否有一个 URL 可以直接获取 Wikipedia 条目的原始标签,而不是 HTML?也就是说,我只想得到这样的东西,
{{about|the cat species that is commonly kept as a pet|the cat family|Felidae|other uses|Cat (disambiguation)|and|Cats (disambiguation)}}....
不是,
<!DOCTYPE html>
<html class="client-nojs" lang="en" dir="ltr">
<head>
<meta charset="UTF-8"/>
<title>Cat - Wikipedia</title> ....
我搜索了谷歌,但找不到答案。我能找到的最接近的 URL 类似于https://en.wikipedia.org/w/index.php?title=Cat&action=edit
,我可以从中提取标签,但它仍然包含不必要的 HTML 内容。
解决方案
您所说的“标签”是Wikitext语法。可以使用“原始”操作为任何页面获取它,例如https://en.wikipedia.org/w/index.php?title=Cat&action=raw。请注意,您将获得与您使用的 action=edit 完全相同的内容,没有其他版本没有“不必要的 HTML 内容”。
推荐阅读
- android - 房间持久性库中的关系
- c++ - 无法使用柯南在 cmake 中找到请求的 Boost 库
- python - 如何解决 python 中的凯撒密码问题?
- c - 为什么 if( -8 & 7) 返回 false
- python - AttributeError:“str”对象没有属性“get”ocr
- java - 如何从 libgdx 中的像素图中获取每个像素的 int 值
- c# - 如何正确实现状态模式?
- datagrip - 元数据库 - 如何从多个数据库创建一个查询
- css - 选择器中的 SCSS 排除
- python - 使用 python abspath 获得的路径打开 Excel 工作簿