Jump to content

API:Gelöschte Versionen

From mediawiki.org
This page is a translated version of the page API:Deletedrevs and the translation is 100% complete.
MediaWiki Version:
1.25
(veraltet in 1.25) Die hier beschriebene API-Dokumentation funktioniert am besten mit MediaWiki 1.14 und früher. Sie ist veraltet und wurde durch die alldeletedrevisions -API ersetzt

GET-Abfrage um gelöschte Versionen aufzulisten.

API-Dokumentation


list=deletedrevs (dr)

(main | query | deletedrevs)
  • This module is deprecated.
  • This module requires read rights.
  • Source: MediaWiki
  • License: GPL-2.0-or-later

List deleted revisions.

Operates in three modes:

  1. List deleted revisions for the given titles, sorted by timestamp.
  2. List deleted contributions for the given user, sorted by timestamp (no titles specified).
  3. List all deleted revisions in the given namespace, sorted by title and timestamp (no titles specified, druser not set).

Certain parameters only apply to some modes and are ignored in others.

Specific parameters:
Other general parameters are available.
drstart

The timestamp to start enumerating from.

Modes: 1, 2
Type: timestamp (allowed formats)
drend

The timestamp to stop enumerating at.

Modes: 1, 2
Type: timestamp (allowed formats)
drdir

In which direction to enumerate:

newer
List oldest first. Note: drstart has to be before drend.
older
List newest first (default). Note: drstart has to be later than drend.
Modes: 1, 3
One of the following values: newer, older
Default: older
drfrom

Start listing at this title.

Mode: 3
drto

Stop listing at this title.

Mode: 3
drprefix

Search for all page titles that begin with this value.

Mode: 3
drunique

List only one revision for each page.

Mode: 3
Type: boolean (details)
drnamespace

Only list pages in this namespace.

Mode: 3
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, 710, 711, 828, 829, 1198, 1199, 2600, 5500, 5501
Default: 0
drtag

Only list revisions tagged with this tag.

druser

Only list revisions by this user.

Type: user, by any of username, IP, Temporary user, interwiki name (e.g. "prefix>ExampleName") and user ID (e.g. "#12345")
drexcludeuser

Don't list revisions by this user.

Type: user, by any of username, IP, Temporary user, interwiki name (e.g. "prefix>ExampleName") and user ID (e.g. "#12345")
drprop

Which properties to get:

revid
Adds the revision ID of the deleted revision.
parentid
Adds the revision ID of the previous revision to the page.
user
Adds the user who made the revision.
userid
Adds the ID of the user who made the revision.
comment
Adds the comment of the revision.
parsedcomment
Adds the parsed comment of the revision.
minor
Tags if the revision is minor.
len
Adds the length (bytes) of the revision.
sha1
Adds the SHA-1 (base 16) of the revision.
content
Adds the content of the revision. For performance reasons, if this option is used, drlimit is enforced to 50.
token
Deprecated. Gives the edit token.
tags
Tags for the revision.
Values (separate with | or alternative): comment, content, len, minor, parentid, parsedcomment, revid, sha1, tags, user, userid, token
Default: user|comment
drlimit

The maximum amount of revisions to list. If drprop=content is used, the limit is 50.

Type: integer or max
The value must be between 1 and 500.
Default: 10
drcontinue

When more results are available, use this to continue. More detailed information on how to continue queries can be found on mediawiki.org.

Examples:
List the last deleted revisions of the pages MediaWiki and Talk:Main Page, with content (mode 1).
api.php?action=query&list=deletedrevs&titles=MediaWiki|Talk%3AMediaWiki&drprop=user|comment|content [open in sandbox]
List the last 50 deleted contributions by Bob (mode 2).
api.php?action=query&list=deletedrevs&druser=Bob&drlimit=50 [open in sandbox]
List the first 50 deleted revisions in the main namespace (mode 3).
api.php?action=query&list=deletedrevs&drdir=newer&drlimit=50 [open in sandbox]
List the first 50 deleted pages in the Talk namespace (mode 3).
api.php?action=query&list=deletedrevs&drdir=newer&drlimit=50&drnamespace=1&drunique= [open in sandbox]

Beispiel

GET-Anfrage

Listet die sechs letzten gelöschten Versionen von Benutzer Catrope am 4. September 2007 auf.

Antwort

<?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>

Beispielcode

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)

Mögliche Fehler

Code Information
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.

Parametergeschichte

  • v1.24: Veralteter drprop: token
  • v1.23: Eingeführt drtag, drprop: tags
  • v1.19: Eingeführt drprop: sha1
  • v1.18: Eingeführt drto, drprefix, drprop: parentid
  • v1.17: Eingeführt drprop: userid
  • v1.16: Eingeführt drprop: parsedcomment
  • v1.15: Eingeführt druser,drexcludeuser,drnamespace, drunique,drfrom

Zusätzliche Anmerkungen

  • Dieses Modul kann nicht als Generator benutzt werden.
  • Du benötigst das deletedhistory-Recht, um dieses Modul zu nutzen. Dieses Modul kann auf drei Arten genutzt werden:
    • Gelöschte Versionen für die (über titles oder einen Generator erhaltenen) Titel auflisten, sortiert nach Zeitstempel
    • Gelöschte Beiträge für einen bestimmten Benutzer auflisten, sortiert nach Zeitstempel (druser gesetzt, keine Titel angegeben)
    • Alle gelöschten Versionen in einem bestimmten Namensraum auflisten (druser nicht gesetzt, keine Titel angegeben)
  • Manche Parameter können nur in bestimmten Modi verwendet werden und sind entsprechend markiert.

Siehe auch