API:Feedrecentchanges

From MediaWiki.org
Jump to navigation Jump to search
This page is a translated version of the page API:Feedrecentchanges and the translation is 100% complete.
Other languages:
Deutsch • ‎English • ‎dansk • ‎español • ‎français • ‎polski • ‎čeština • ‎ไทย • ‎中文 • ‎日本語 • ‎한국어
MediaWiki バージョン: 1.23

最近の更新のフィードを返す GET リクエストです。

APIの説明文書


action=feedrecentchanges

(main | feedrecentchanges)

Returns a recent changes feed.

Parameters:
feedformat

The format of the feed.

One of the following values: atom, rss
Default: rss
namespace

Namespace to limit the results to.

One of the following values: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 90, 91, 92, 93, 100, 101, 102, 103, 104, 105, 106, 107, 486, 487, 828, 829, 1198, 1199, 2300, 2301, 2302, 2303, 2600, 5500, 5501
invert

All namespaces but the selected one.

Type: boolean (details)
associated

Include associated (talk or main) namespace.

Type: boolean (details)
days

Days to limit the results to.

Type: integer
The value must be no less than 1.
Default: 7
limit

Maximum number of results to return.

Type: integer
The value must be between 1 and 50.
Default: 50
from

Show changes since then.

Type: timestamp (allowed formats)
hideminor

Hide minor changes.

Type: boolean (details)
hidebots

Hide changes made by bots.

Type: boolean (details)
hideanons

Hide changes made by anonymous users.

Type: boolean (details)
hideliu

Hide changes made by registered users.

Type: boolean (details)
hidepatrolled

Hide patrolled changes.

Type: boolean (details)
hidemyself

Hide changes made by the current user.

Type: boolean (details)
hidecategorization

Hide category membership changes.

Type: boolean (details)
tagfilter

Filter by tag.

target

Show only changes on pages linked from this page.

showlinkedto

Show changes on pages linked to the selected page instead.

Type: boolean (details)

最近の変更をRSSフィードとして表示します。

レスポンス

<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>MediaWiki - Recent changes [en]</title>
    <link>
      https://www.mediawiki.org/wiki/Special:RecentChanges
    </link>
    <description>
      Track the most recent changes to the wiki in this feed.
    </description>
    <language>en</language>
    <generator>MediaWiki 1.27.0-wmf.6</generator>
    <lastBuildDate>Thu, 12 Nov 2015 22:55:31 GMT</lastBuildDate>
    <item>
      <title>Reading/Component responsibility</title>
      <link>
        https://www.mediawiki.org/w/index.php?title=Reading/Component_responsibility&diff=1937428&oldid=1937427
      </link>
      <guid isPermaLink="false">
        https://www.mediawiki.org/w/index.php?title=Reading/Component_responsibility&diff=1937428&oldid=1937427
      </guid>
      <description>
        ...
      </description>
      <pubDate>Thu, 12 Nov 2015 20:42:06 GMT</pubDate>
      <dc:creator>Salawad</dc:creator>
      <comments>https://www.mediawiki.org/wiki/User_talk:Salawad</comments>
    </item>
  </channel>
</rss>

サンプル コード

Python

#!/usr/bin/python3

"""
    get_feed_recent_changes.py

    MediaWiki API Demos
    Demo of `Feedrecentchanges` module: Show recent changes as an RSS feed.

    MIT License
"""

import requests

S = requests.Session()

URL = "https://en.wikipedia.org/w/api.php"

PARAMS = {
    "action": "feedrecentchanges",
    "format": "json"
}

R = S.get(url=URL, params=PARAMS)
DATA = R.content

print(DATA)

PHP

<?php
/*
    get_feed_recent_changes.php

    MediaWiki API Demos
    Demo of `Feedrecentchanges` module: Show recent changes as an RSS feed.

    MIT License
*/

$endPoint = "https://en.wikipedia.org/w/api.php";
$params = [
    "action" => "feedrecentchanges",
    "format" => "json"
];

$url = $endPoint . "?" . http_build_query( $params );

$ch = curl_init( $url );
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, true );
$output = curl_exec( $ch );
curl_close( $ch );

var_dump( $output );

JavaScript

/*
    get_feed_recent_changes.js

    MediaWiki API Demos
    Demo of `Feedrecentchanges` module: Show recent changes as an RSS feed.

    MIT License
*/

var url = "https://en.wikipedia.org/w/api.php"; 

var params = {
    action: "feedrecentchanges",
    format: "json"
};

url = url + "?origin=*";
Object.keys(params).forEach(function(key){url += "&" + key + "=" + params[key];});

fetch(url)
    .then(function(response){return response.json();})
    .then(function(response) {console.log(response);})
    .catch(function(error){console.log(error);});

MediaWiki JS

/*
	get_feed_recent_changes.js

	MediaWiki API Demos
	Demo of `Feedrecentchanges` module: Show recent changes as an RSS feed.

	MIT License
*/

var params = {
		action: 'feedrecentchanges',
		format: 'json'
	},
	api = new mw.Api();

api.get( params ).done( function ( data ) {
	console.log( data );
} );

起こりうるエラー

標準のエラー メッセージに加えて:

コード 情報
feed-unavailable フィードの配信は利用できません
feed-invalid フィード形式の指定が正しくありません。
invalidtitle Bad title "$1".

パラメーターの履歴

  • v1.28: hidecategorization を導入しました

追加的な注記

  • 要求が成功した場合、出力が feedformat パラメーターで要求された形式になることに注意してください。 エラーが発生した場合は、標準の format 属性 (例: JSON) のみ適用されます。

関連項目