WikiTeam / wikiteam

Tools for downloading and preserving wikis. We archive wikis, from Wikipedia to tiniest wikis. As of 2024, WikiTeam has preserved more than 600,000 wikis.
https://github.com/WikiTeam
GNU General Public License v3.0
729 stars 149 forks source link

Handle choice of API for version unsupported by mwclient #392

Open nemobis opened 4 years ago

nemobis commented 4 years ago

mwclient wants MediaWiki 1.16. Maybe we can work around it when we get an error, or at least try again with a guessed index.php.

$ python dumpgenerator.py --xml --images --xmlrevisions --api=http://igra-govno.com/api.php                                                                [72/78]
Checking API... http://igra-govno.com/api.php
MediaWiki API seems to work but returned no index URL
Traceback (most recent call last):
  File "dumpgenerator.py", line 2528, in <module>
    main()
  File "dumpgenerator.py", line 2474, in main
    config, other = getParameters(params=params)
  File "dumpgenerator.py", line 1779, in getParameters
    check, checkedapi = checkRetryAPI(api, args.retries, args.xmlrevisions, session)
  File "dumpgenerator.py", line 1917, in checkRetryAPI
    site = mwclient.Site(apiurl.netloc, apiurl.path.replace("api.php", ""), scheme=apiurl.scheme)
  File "/home/users/federico/.local/lib/python2.7/site-packages/mwclient/client.py", line 131, in __init__
    self.site_init()
  File "/home/users/federico/.local/lib/python2.7/site-packages/mwclient/client.py", line 166, in site_init
    self.require(1, 16)
  File "/home/users/federico/.local/lib/python2.7/site-packages/mwclient/client.py", line 464, in require
    current=(self.version[:2]))
mwclient.errors.MediaWikiVersionError: Requires version 1.16, current version is 1.15
nathanwaldman commented 4 years ago

I just ran into this yesterday for my version 1.10 media wiki. I posted about it over here. Are there older versions of mwclient that support older media wiki API versions? Are they a drop in replacement for dumpgenerator.py? I started tweaking the code to remove the userinfo argument to the meta API parameter, but then ran in to the version check you described:

mwclient.errors.MediaWikiVersionError: Requires version 1.16, current version is 1.10

nemobis commented 4 years ago

Nathan Waldman, 15/08/20 01:31:

Are there older versions of mwclient that support older media wiki API versions?

I don't know, but you can use an older version of dumpgenerator which used wikitools instead.