API:Feedrecentchanges/fr
Cette page fait partie de la documentation de l'API MediaWiki Action. |
Version de MediaWiki : | ≥ 1.23 |
GET request to return a recent changes feed.
Documentation de l'API
Exemple
Show recent changes as an RSS feed.
Réponse
<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>
Exemple de code
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 );
} );
Erreurs possibles
In addition to the standard error messages:
Code | Info |
---|---|
feed-unavailable | Les flux de syndication ne sont pas disponibles |
feed-invalid | Type de flux d’abonnement non valide. |
invalidtitle | Mauvais titre « $1 ». |
Historique des paramètres
- v1.28: Ajouté
hidecategorization
Notes supplémentaires
- Note that if the request is successful, the output will be in the format requested by the
feedformat
parameter. Le format demandé par le paramètre standardformat
(ex.: JSON), ne sera utilisé qu'en cas d'erreur.
Voir aussi
- API:Feedcontributions - Returns a user's contributions feed.
- API:Feedwatchlist - Returns a watchlist feed.