我正在使用 parse
模块从 Wikipedia api 检索文章内容:
"http://en.wikipedia.org/w/api.php?action=parse&format=json&page=[...]&callback=JSON_CALLBACK ";
我返回的是一个对象,其中包含(以及其他属性)所请求页面的 html 内容。我还想要的是所请求页面的 pageid。不幸的是,这不包括在内,除了使用 query
模块发出第二个请求之外,我找不到其他方法来获取它。
使用解析模块请求文章时是否可以获取pageid?
最佳答案
Is it possible to get the pageid when requesting an article using the parse module?
我不这么认为。通常您知道您感兴趣的页面的 id/标题标识符。但是,您将返回已解析的修订版本的 id。
What I get back is an object with the html content of the requested page on it.
如果这是您唯一感兴趣的事情,只需使用查询 API 即可! revision
module也会为您提供解析的内容:
http://en.wikipedia.org/w/api.php?action=query&prop=revisions&rvparse=1&titles=[…]&format=json&callback=JSON_CALLBACK
关于javascript - 从维基百科解析请求中检索 pageid,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25595579/