From 9c425e5dd31b666300604991cd13c474fab7cc95 Mon Sep 17 00:00:00 2001 From: yzqzss Date: Thu, 5 Dec 2024 01:38:19 +0800 Subject: [PATCH] minor refactor read_titles() always return string --- wikiteam3/dumpgenerator/dump/page/xmlrev/xml_revisions.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/wikiteam3/dumpgenerator/dump/page/xmlrev/xml_revisions.py b/wikiteam3/dumpgenerator/dump/page/xmlrev/xml_revisions.py index 8a4f5b7a..dbdd3451 100644 --- a/wikiteam3/dumpgenerator/dump/page/xmlrev/xml_revisions.py +++ b/wikiteam3/dumpgenerator/dump/page/xmlrev/xml_revisions.py @@ -320,11 +320,9 @@ def getXMLRevisionsByTitles(config: Config, session: requests.Session, site: mwc titlelist = [] # TODO: Decide a suitable number of a batched request. Careful: # batched responses may not return all revisions. - for titlelist in read_titles(config, session=session, start=start): - if isinstance(titlelist, str): - titlelist = [titlelist] - for title in titlelist: - print(f" {title}") + for title in read_titles(config, session=session, start=start): + print(f" {title}") + titlelist = [title] # Try and ask everything. At least on MediaWiki 1.16, uknown props are discarded: # "warnings":{"revisions":{"*":"Unrecognized values for parameter 'rvprop': userid, sha1, contentmodel"}}} pparams = {