- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我只需要检索维基百科页面的第一段。
内容必须采用 HTML 格式,准备好在我的网站上显示(因此不 BBCode 或维基百科特殊代码!)
最佳答案
有一种方法无需任何 HTML 解析即可获取整个“介绍部分”!类似于 AnthonyS's answer通过附加的 explaintext
参数,您可以获得纯文本的介绍部分文本。
以纯文本形式获取 Stack Overflow 的介绍:
使用页面标题:
或者使用pageids
:
(警告已删除)
{
"query": {
"pages": {
"21721040": {
"pageid": 21721040,
"ns": 0,
"title": "Stack Overflow",
"extract": "Stack Overflow is a privately held website, the flagship site of the Stack Exchange Network, created in 2008 by Jeff Atwood and Joel Spolsky, as a more open alternative to earlier Q&A sites such as Experts Exchange. The name for the website was chosen by voting in April 2008 by readers of Coding Horror, Atwood's popular programming blog.\nIt features questions and answers on a wide range of topics in computer programming. The website serves as a platform for users to ask and answer questions, and, through membership and active participation, to vote questions and answers up or down and edit questions and answers in a fashion similar to a wiki or Digg. Users of Stack Overflow can earn reputation points and \"badges\"; for example, a person is awarded 10 reputation points for receiving an \"up\" vote on an answer given to a question, and can receive badges for their valued contributions, which represents a kind of gamification of the traditional Q&A site or forum. All user-generated content is licensed under a Creative Commons Attribute-ShareAlike license. Questions are closed in order to allow low quality questions to improve. Jeff Atwood stated in 2010 that duplicate questions are not seen as a problem but rather they constitute an advantage if such additional questions drive extra traffic to the site by multiplying relevant keyword hits in search engines.\nAs of April 2014, Stack Overflow has over 2,700,000 registered users and more than 7,100,000 questions. Based on the type of tags assigned to questions, the top eight most discussed topics on the site are: Java, JavaScript, C#, PHP, Android, jQuery, Python and HTML."
}
}
}
}
关于wikipedia - 是否有一个维基百科 API 仅用于检索内容摘要?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8555320/
好吧,我看过一些帖子提到其他一些关于不使用 SP wiki 的帖子,因为它们很糟糕。 既然我们正在考虑在 SP 中创建 wiki,我需要知道为什么我们不应该让 6 名自动化开发人员来记录各种自动化流程
在 GitLab Wiki 部分,可以查看保存更改的历史记录。但是,当您单击提交链接时,它将显示该保存中存在的整个文件。有谁知道一种方法来区分提交以仅获取两个提交之间的差异? 这类似于它在 merge
我使用了 Wiki API 文档中的一些示例代码,但是当我输入搜索项时,没有任何反应。控制台中没有错误,什么也没有。如果我将 URL 输入到浏览器中,URL 本身就会起作用,所以我认为代码中的某些内容
我想在我的 wiki 中创建一个层次结构,如下所示: General FooPages Foo1 Foo2 Foo3 ODP Bar Baz 我想创建这些页
我正在尝试使用为 Python 制作的 Wikimapia 的 pymapia API,但无法理解如何正确使用它。 import pymapia as PyMapia a = PyMapia.PyMa
我正在开发适用于 iOS 的客户端应用程序,用于在 Mac OS X 服务器(Snow Leopard 和 Lion)上编辑内置的 Wiki/Blog。 看来我们可以使用 MetaWeblog 、At
我正在编写一些 URL 重写软件,我想从多个角度了解哪种 URL 方案更可取: 博客风格:my-chemistry-answer -- 为什么? -- (不可取,技术性) Wiki 风格:My_Che
我一直试图找到一种方法来在 Azure DevOps Wiki 中创建子页面的目录。我从其他 wiki 服务中找到了方法。 在 Confluence 中,他们有一个用于“ child 显示”的宏 我为
我是一名优秀的程序员,十分优秀!