API:Feedcontributions/ru
Эта страница является частью документации по API действий MediaWiki. |
Версия MediaWiki: | ≥ 1.18 |
GET request to return a user's contributions feed.
API documentation
Example
GET request
Show contributions of a user as an RSS feed.
Response
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
<channel>
<title>Wikipedia - User contributions [en]</title>
<link>
https://en.wikipedia.org/wiki/Special:Contributions/Jimbo_Wales
</link>
<description>User contributions</description>
<language>en</language>
<generator>MediaWiki 1.27.0-wmf.5</generator>
<lastBuildDate>Wed, 11 Nov 2015 20:56:27 GMT</lastBuildDate>
<item>
<title>User talk:Jimbo Wales</title>
<link>
https://en.wikipedia.org/w/index.php?title=User_talk:Jimbo_Wales&diff=###
</link>
<guid isPermaLink="false">
https://en.wikipedia.org/w/index.php?title=User_talk:Jimbo_Wales&diff=###
</guid>
<description>
...
</description>
<comments>
https://en.wikipedia.org/wiki/User_talk:Jimbo_Wales
</comments>
</item>
</channel>
</rss>
Sample code
Python
#!/usr/bin/python3
"""
get_user_contributions_feed.py
MediaWiki API Demos
Demo of `Feedcontributions` module: Show contributions of a user as an RSS feed.
MIT License
"""
import requests
S = requests.Session()
URL = "https://en.wikipedia.org/w/api.php"
PARAMS = {
"action": "feedcontributions",
"user": "Jimbo Wales",
"format": "json"
}
R = S.get(url=URL, params=PARAMS)
DATA = R.content
print(DATA)
PHP
<?php
/*
get_user_contributions_feed.php
MediaWiki API Demos
Demo of `Feedcontributions` module: Show contributions of a user as an RSS feed.
MIT License
*/
$endPoint = "https://en.wikipedia.org/w/api.php";
$params = [
"action" => "feedcontributions",
"user" => "Jimbo Wales",
"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_user_contributions_feed.js
MediaWiki API Demos
Demo of `Feedcontributions` module: Show contributions of a user as an RSS feed.
MIT License
*/
var url = "https://en.wikipedia.org/w/api.php";
var params = {
action: "feedcontributions",
user: "Jimbo Wales",
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_user_contributions_feed.js
MediaWiki API Demos
Demo of `Feedcontributions` module: Show contributions of a user as an RSS feed.
MIT License
*/
var params = {
action: 'feedcontributions',
user: 'Jimbo Wales',
format: 'json'
},
api = new mw.Api();
api.get( params ).done( function ( data ) {
console.log( data );
} );
Possible errors
In addition to the standard error messages:
Code | Info |
---|---|
feed-unavailable | Ленты синдикации недоступны |
feed-invalid | Неправильный тип канала для подписки. |
sizediffdisabled | Подсчёт разницы размеров отключён в жадном режиме. |
Parameter history
- v1.28: Introduced
hideminor
- v1.23: Introduced
newonly
Additional notes
- Note that if the request is successful, the output will be in the format requested by the
feedformat
parameter. The format requested by the standardformat
parameter (e.g., JSON) will only be used in the event of an error.
См. также
- API:Feedrecentchanges - Returns a recent changes feed.
- API:Feedwatchlist - Returns a watchlist feed.