API:RecentChanges/ar
![]() | هذه الصفحة جزء من توثيق واجهة برمجة تطبيقات ميدياويكي التي تحمل اسم Action. |
إصدار ميدياويكي: | ≥ 1.9 |
طلب GET يسرد قائمة بكافة أحدث التغييرات على موقع الويكي، بنفس الطريقة التي تسردها صفحة Special:RecentChanges.
توثيق واجهة برمجة التطبيقات
![]() | أعمال التوثيق التالية هي نتاج صفحة Special: |
list=recentchanges (rc)
- This module requires read rights.
- This module can be used as a generator.
- Source: MediaWiki
- License: GPL-2.0-or-later
Enumerate recent changes.
- rcstart
The timestamp to start enumerating from.
- Type: timestamp (allowed formats)
- rcend
The timestamp to end enumerating.
- Type: timestamp (allowed formats)
- rcdir
In which direction to enumerate:
- newer
- List oldest first. Note: rcstart has to be before rcend.
- older
- List newest first (default). Note: rcstart has to be later than rcend.
- One of the following values: newer, older
- Default: older
- rcnamespace
Filter changes to only these namespaces.
- Values (separate with | or alternative): -1, -2, 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, 710, 711, 828, 829, 1198, 1199, 2600, 5500, 5501
- To specify all values, use *.
- rcuser
Only list changes by this user.
- Type: user, by any of username, IP, Temporary user, interwiki name (e.g. "prefix>ExampleName") and user ID (e.g. "#12345")
- rcexcludeuser
Don't list changes by this user.
- Type: user, by any of username, IP, Temporary user, interwiki name (e.g. "prefix>ExampleName") and user ID (e.g. "#12345")
- rctag
Only list changes tagged with this tag.
- rcprop
Include additional pieces of information:
- user
- Adds the user responsible for the edit and tags if they are an IP. If the user has been revision deleted, a userhidden property will be returned.
- userid
- Adds the user ID responsible for the edit. If the user has been revision deleted, a userhidden property will be returned.
- comment
- Adds the comment for the edit. If the comment has been revision deleted, a commenthidden property will be returned.
- parsedcomment
- Adds the parsed comment for the edit. If the comment has been revision deleted, a commenthidden property will be returned.
- flags
- Adds flags for the edit.
- timestamp
- Adds timestamp of the edit.
- title
- Adds the page title of the edit.
- ids
- Adds the page ID, recent changes ID and the new and old revision ID.
- sizes
- Adds the new and old page length in bytes.
- redirect
- Tags edit if page is a redirect.
- patrolled
- Tags patrollable edits as being patrolled or unpatrolled.
- loginfo
- Adds log information (log ID, log type, etc) to log entries.
- tags
- Lists tags for the entry.
- sha1
- Adds the content checksum for entries associated with a revision. If the content has been revision deleted, a sha1hidden property will be returned.
- Values (separate with | or alternative): comment, flags, ids, loginfo, parsedcomment, patrolled, redirect, sha1, sizes, tags, timestamp, title, user, userid
- Default: title|timestamp|ids
- rcshow
Show only items that meet these criteria. For example, to see only minor edits done by logged-in users, set rcshow=minor|!anon.
- Values (separate with | or alternative): !anon, !autopatrolled, !bot, !minor, !patrolled, !redirect, anon, autopatrolled, bot, minor, patrolled, redirect, unpatrolled
- rclimit
How many total changes to return.
- Type: integer or max
- The value must be between 1 and 500.
- Default: 10
- rctype
Which types of changes to show.
- Values (separate with | or alternative): categorize, edit, external, log, new
- Default: edit|new|log|categorize
- rctoponly
Only list changes which are the latest revision.
- Type: boolean (details)
- rctitle
Filter entries to those related to a page.
- rccontinue
When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.
- rcgeneraterevisions
When being used as a generator, generate revision IDs rather than titles. Recent change entries without associated revision IDs (e.g. most log entries) will generate nothing.
- Type: boolean (details)
- rcslot
Only list changes that touch the named slot.
- One of the following values: main
- List recent changes.
- api.php?action=query&list=recentchanges [open in sandbox]
- Get page info about recent unpatrolled changes.
- api.php?action=query&generator=recentchanges&grcshow=!patrolled&prop=info [open in sandbox]
مثال
طلب GET
النتيجة
{
"batchcomplete": "",
"continue": {
"rccontinue": "20180330090522|1041353210",
"continue": "-||"
},
"query": {
"recentchanges": [
{
"type": "edit",
"ns": 0,
"title": "Histology",
"pageid": 13570,
"revid": 833218500,
"old_revid": 833218201,
"rcid": 1041353213,
"user": "Iztwoz",
"oldlen": 25718,
"newlen": 25749
}
...
]
}
}
عينة من الكود البرمجي
Python
#!/usr/bin/python3
"""
get_recent_changes.py
MediaWiki API Demos
Demo of `RecentChanges` module: Get the three most recent changes with
sizes and flags
MIT License
"""
import requests
S = requests.Session()
URL = "https://en.wikipedia.org/w/api.php"
PARAMS = {
"format": "json",
"rcprop": "title|ids|sizes|flags|user",
"list": "recentchanges",
"action": "query",
"rclimit": "3"
}
R = S.get(url=URL, params=PARAMS)
DATA = R.json()
RECENTCHANGES = DATA['query']['recentchanges']
for rc in RECENTCHANGES:
print(str(rc['title']))
PHP
<?php
/*
get_recent_changes.php
MediaWiki API Demos
Demo of `RecentChanges` module: Get the three most recent changes with sizes and flags
MIT License
*/
$endPoint = "https://en.wikipedia.org/w/api.php";
$params = [
"action" => "query",
"list" => "recentchanges",
"rcprop" => "title|ids|sizes|flags|user",
"rclimit" => "3",
"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 );
$result = json_decode( $output, true );
foreach( $result["query"]["recentchanges"] as $rc ){
echo( $rc["title"] . "\n" );
}
JavaScript
/*
get_recent_changes.js
MediaWiki API Demos
Demo of `RecentChanges` module: Get the three most recent changes with sizes and flags
MIT License
*/
var url = "https://en.wikipedia.org/w/api.php";
var params = {
action: "query",
list: "recentchanges",
rcprop: "title|ids|sizes|flags|user",
rclimit: "3",
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) {
var recentchanges = response.query.recentchanges;
for (var rc in recentchanges) {
console.log(recentchanges[rc].title);
}
})
.catch(function(error){console.log(error);});
MediaWiki JS
/*
get_recent_changes.js
MediaWiki API Demos
Demo of `RecentChanges` module: Get the three most recent changes with sizes and flags
MIT License
*/
var params = {
action: 'query',
list: 'recentchanges',
rcprop: 'title|ids|sizes|flags|user',
rclimit: '3',
format: 'json'
},
api = new mw.Api();
api.get( params ).done( function ( data ) {
var recentchanges = data.query.recentchanges,
rc;
for ( rc in recentchanges ) {
console.log( recentchanges[ rc ].title );
}
} );
الأخطاء المحتملة
الكود | معلومات |
---|---|
rcshow | وسيط غير صحيحة; قد لا يتم تقديم قيم خاصة متبادلة. |
rcpermissiondenied | تحتاج إلى صلاحيةpatrol أو patrolmarks لطلب علم مراجع. |
تاريخ المتغيرات
- v1.24:
rctoken
متقادم - v1.15: إزالة
rctitles
- v1.14: إضافة
rctitles
- v1.13: إضافة
loginfo
ملاحظات إضافية
- يمكن الاطلاع على عدة تصرفات سجل مستخدمًا هذه الوحدة البرمجية عدا تصرفات المراقبة منذ أنها ليست موجودة في جدول recentchanges .
- لا يجوز أن يكون ختم زمني الذي تبدأ القائمة منه أكبر من $wgRCMaxAge في الماضي، وهو 30 يوم على مواقع الويكي التابعة لويكيميديا.
- يجوز إدراج التغييرات الجديدة إلى جدول
recentchanges
بترتيب غير صحيح قليلًا فيما يخص ختمها الزمني. لهذا السبب، حينما تطلب أحدث التغييرات مرتين متتابعتين، يجوز أن يحتوي الرد الثاني على تغييرات حديثة مدرجة بعد بضع ثوانٍ قبل أحدث التغييرات المذكورة في الرد الأول. لو استدعيت هذه الوحدة البرمجية تكرارًا للحصول على دفق بيانات بأحدث التغييرات، فكر جديًا في إضافة مقدار من التداخل بين الطلبات حتى لا تغفل أية تغييرات. - يمكن استخدام هذه الوحدة البرمجية بصفة مولّد.
- ينفذ هذه الوحدة البرمجية ApiQueryRecentChanges.php .