API:Deletedrevs/ru
Appearance
Эта страница является частью документации по API действий MediaWiki. |
Версия MediaWiki: | ≤ 1.25 |
(устарело в 1.25) The API documentation described here will work best with MediaWiki 1.14 and earlier. It has been deprecated in favor of
alldeletedrevisions
apiGET request to list deleted revisions.
Документация по API
Пример
GET-запрос
List the 6 most recent deleted revisions from user Catrope dated September 4, 2007.
api.php? action=query& list=deletedrevs& drstart=20070904235959& drend=20070904000000& drprop=revid|user|minor|len|token& drlimit=6& druser=Catrope& format=json [попробуйте в ApiSandbox]
Ответ
<?xml version="1.0" encoding="utf-8"?>
<api>
<query-continue>
<deletedrevs drstart="20070904142729" />
</query-continue>
<query>
<deletedrevs>
<page title="Main Page" ns="0" token="e4c475f13be7824135b4edbebf4140ff+\">
<revisions>
<rev timestamp="20070904200804" revid="31" user="Catrope" minor="" len="" />
<rev timestamp="20070904200753" revid="30" user="Catrope" minor="" len="" />
<rev timestamp="20070904193501" revid="29" user="Catrope" minor="" len="568" />
<rev timestamp="20070904193213" revid="28" user="Catrope" minor="" len="470" />
</revisions>
</page>
<page title="User:Catrope" ns="2" token="e4c475f13be7824135b4edbebf4140ff+\">
<revisions>
<rev timestamp="20070904143938" revid="24" user="Catrope" len="52" />
<rev timestamp="20070904142758" revid="23" user="Catrope" len="37" />
</revisions>
</page>
</deletedrevs>
</query>
</api>
Пример кода
get_deleted_revisions.py
#!/usr/bin/python3
"""
get_deleted_revisions.py
MediaWiki Action API Code Samples
Demo of `Deletedrevs` module: List the six most recent deleted revisions
from User:Catrope
MIT License
"""
import requests
S = requests.Session()
URL = "https://en.wikipedia.org/w/api.php"
PARAMS = {
"drend": "20070904000000",
"format": "json",
"druser": "Catrope",
"list": "deletedrevs",
"drstart": "20070904235959",
"drlimit": "6",
"drprop": "revid|user|minor|len|token",
"action": "query"
}
R = S.get(url=URL, params=PARAMS)
DATA = R.json()
print(DATA)
Возможные ошибки
Код | Info |
---|---|
drpermissiondenied | You don't have permission to view deleted revision information. On most wikis, viewing deleted revisions is restricted to sysops, but other wikis may have different rules. |
История параметров
- v1.24: Устарели
drprop: token
- v1.23: Введены
drtag
,drprop: tags
- v1.19: Введены
drprop: sha1
- v1.18: Введены
drto
,drprefix
,drprop: parentid
- v1.17: Введены
drprop: userid
- v1.16: Введены
drprop: parsedcomment
- v1.15: Введены
druser
,drexcludeuser
,drnamespace
,drunique
,drfrom
Additional notes
- This module cannot be used as a generator .
- You need the
deletedhistory
right to use this module.
This module can be used in one of three modes:
- List deleted revisions for the given titles (through
titles
or a generator), sorted by timestamp
- List deleted revisions for the given titles (through
- List deleted contributions for a certain user, sorted by timestamp (
druser
set, no titles given)
- List deleted contributions for a certain user, sorted by timestamp (
- List all deleted revisions in a certain namespace (
druser
not set, no titles given)
- List all deleted revisions in a certain namespace (
- Some parameters are restricted to certain modes only, and are marked accordingly.