Browse Source

Use rvslots for fetching revision content

copyvios-ng
Ben Kurtovic 5 years ago
parent
commit
96ac14ec38
1 changed files with 7 additions and 4 deletions
  1. +7
    -4
      copyvios/checker.py

+ 7
- 4
copyvios/checker.py View File

@@ -100,13 +100,16 @@ def _get_results(query, follow=True):


def _get_page_by_revid(site, revid): def _get_page_by_revid(site, revid):
res = site.api_query(action="query", prop="info|revisions", revids=revid, res = site.api_query(action="query", prop="info|revisions", revids=revid,
rvprop="content|timestamp", inprop="protection|url")
rvprop="content|timestamp", inprop="protection|url",
rvslots="main")
try: try:
page_data = res["query"]["pages"].values()[0] page_data = res["query"]["pages"].values()[0]
title = page_data["title"] title = page_data["title"]
page_data["revisions"][0]["*"] # Only need to check that these exist
page_data["revisions"][0]["timestamp"]
except KeyError:
# Only need to check that these exist:
revision = page_data["revisions"][0]
revision["slots"]["main"]["*"]
revision["timestamp"]
except (KeyError, IndexError):
return None return None
page = site.get_page(title) page = site.get_page(title)




Loading…
Cancel
Save