gpt4 book ai didi

wikipedia-api - 寻找可以给我他们的 XML 文章的维基百科 api

转载 作者:行者123 更新时间:2023-12-05 03:15:53 25 4
gpt4 key购买 nike

我正在寻找一个维基百科 api,它可以为我提供相应查询的文章(无图像)。我已经看到与 actions=opensearchquery=search 一起使用的 wikipedia api。请告诉我哪一个是正确的,或者是否还有我应该使用的任何其他action

最佳答案

参见 WikiMedia API helpcomplete documentation .

不清楚您希望返回给您​​的是什么,是文章还是搜索结果。无论哪种方式,要获得 xml 格式的结果,请使用 format=xml

要获取与特定查询匹配的文章列表,请使用 opensearch action .例如:
http://en.wikipedia.org/w/api.php?action=opensearch&search=MediaWiki&format=xml - View the results

来自 API help 中关于 action=opensearch 的部分:

* action=opensearch *  Searches the wiki using the OpenSearch protocolThis module requires read rightsParameters:  search     - Search string  limit      - Maximum amount of results to return               No more than 100 (100 for bots) allowed               Default: 10  namespace  - Namespaces to search               Values (separate with '|'): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,                   13, 14, 15               Maximum number of values 50 (500 for bots)               Default: 0  suggest    - Do nothing if $wgEnableOpenSearchSuggest is false  format     - Output format defaults to JSON, with expanded XML optional.               One value: json, jsonfm, xml, xmlfm               Default: jsonExample:  api.php?action=opensearch&search=Te


要获取特定文章的内容,请使用 parse action .例如:
http://en.wikipedia.org/w/api.php?action=parse&page=MediaWiki&format=xml - View the results

来自 API help 中关于 action=parse 的部分:

* action=parse *  Parses wikitext and returns parser outputThis module requires read rightsParameters:  title       - Title of page the text belongs to                Default: API  text        - Wikitext to parse  summary     - Summary to parse  page        - Parse the content of this page. Cannot be used together with                    text and title  pageid      - Parse the content of this page. Overrides page  redirects   - If the page or the pageid parameter is set to a redirect, resolve it  oldid       - Parse the content of this revision. Overrides page and pageid  prop        - Which pieces of information to get                 text           - Gives the parsed text of the wikitext                 langlinks      - Gives the language links in the parsed wikitext                 categories     - Gives the categories in the parsed wikitext                 categorieshtml - Gives the HTML version of the categories                 languageshtml  - Gives the HTML version of the language links                 links          - Gives the internal links in the parsed wikitext                 templates      - Gives the templates in the parsed wikitext                 images         - Gives the images in the parsed wikitext                 externallinks  - Gives the external links in the parsed wikitext                 sections       - Gives the sections in the parsed wikitext                 revid          - Adds the revision ID of the parsed page                 displaytitle   - Adds the title of the parsed wikitext                 headitems      - Gives items to put in the  of the page                 headhtml       - Gives parsed  of the page                 iwlinks        - Gives interwiki links in the parsed wikitext                 wikitext       - Gives the original wikitext that was parsed                Values (separate with '|'): text, langlinks, languageshtml,                    categories, categorieshtml, links, templates, images,                    externallinks, sections, revid, displaytitle, headitems,                    headhtml, iwlinks, wikitext                Default: text|langlinks|categories|links|templates|images|                         externallinks|sections|revid|displaytitle  pst         - Do a pre-save transform on the input before parsing it                Ignored if page, pageid or oldid is used  onlypst     - Do a pre-save transform (PST) on the input, but don't parse it                Returns the same wikitext, after a PST has been applied. Ignored if                    page, pageid or oldid is used  uselang     - Which language to parse the request in  section     - Only retrieve the content of this section number  disablepp   - Disable the PP Report from the parser outputExample:  api.php?action=parse&text={{Project:Sandbox}}

关于wikipedia-api - 寻找可以给我他们的 XML 文章的维基百科 api,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8908318/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com