2012-01-18 10 views
2

私はそれぞれの質問に記事(画像なし)を与えることができるwikipedia APIを探しています。 私はactions=opensearchquery=searchで使用されているウィキペディアAPIを見ました。 どちらが正しいか、それ以外のものがある場合は教えてくださいaction私は使うべきです。XMLで記事を投稿できるwikipedia apiを探しています

答えて

4

WikiMedia API helpまたはcomplete documentationを参照してください。

あなたがあなたに返すことを望んでいるもの、記事または検索結果は不明です。いずれにせよ、xmlで結果を得るには、format=xmlを使用してください。

特定のクエリに一致する記事のリストを取得するには、opensearch actionを使用します。たとえば:
http://en.wikipedia.org/w/api.php?action=opensearch&search=MediaWiki&format=xmlからAPI helpaction=opensearch上のセクションからView the results

 
* action=opensearch * 
    Searches the wiki using the OpenSearch protocol 

This module requires read rights 
Parameters: 
    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: json 
Example: 
    api.php?action=opensearch&search=Te 


は、特定の記事の内容を取得するには、parse actionを使用しています。たとえば:
http://en.wikipedia.org/w/api.php?action=parse&page=MediaWiki&format=xmlからAPI helpaction=parse上のセクションからView the results

://:

 
* action=parse * 
    Parses wikitext and returns parser output 

This module requires read rights 
Parameters: 
    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 output 
Example: 
    api.php?action=parse&text={{Project:Sandbox}} 
+0

はOPも '['小道具= revisions'](HTTPSでアクション= query'をお勧めしますwww.mediawiki.org/wiki/API:Properties#revisions_.2F_rv)、もし彼らが解析されたHTML出力の代わりに生のwikitextに興味があれば。 (私はそれが 'prop = wikitext'で' action = parse'よりも効率的なら100%確信していませんが、それが疑わしいです。) –

+0

あなたはaction = parseを使用して結果を得る必要があると言っています。あなたがインドで記事を入手しなければならないかどうか教えてください。もし私がしなければならないことは何でもあります.plzzzz –

+2

@shivamoberoi - 私はあなたにどのくらいの情報を与えることができません。あなたが望むなら、私はちょうどあなたのためにあなたのコードを書くでしょう...私のレートは100ドル/時です。 – gilly3

関連する問題