mediawiki-client-tools / mediawiki-dump-generator

Python 3 tools for downloading and preserving wikis
https://github.com/mediawiki-client-tools/mediawiki-scraper
GNU General Public License v3.0
95 stars 14 forks source link

KeyError: 'sha1' when getting list of images #123

Closed robkam closed 1 year ago

robkam commented 1 year ago

$ dumpgenerator --xml --xmlrevisions --images --api https://elinux.org/api.php --stdout-log-file elinux.txt

\<snipped>

Using API:Allimages to get the list of images
..........................................................................................................................................................Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Python\Scripts\dumpgenerator.exe\__main__.py", line 7, in <module>
  File "C:\Python\Lib\site-packages\wikiteam3\dumpgenerator\__init__.py", line 26, in main
    DumpGenerator()
  File "C:\Python\Lib\site-packages\wikiteam3\dumpgenerator\dump\generator.py", line 115, in __init__
    DumpGenerator.createNewDump(config=config, other=other)
  File "C:\Python\Lib\site-packages\wikiteam3\dumpgenerator\dump\generator.py", line 131, in createNewDump
    images += Image.getImageNames(config=config, session=other["session"])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python\Lib\site-packages\wikiteam3\dumpgenerator\dump\image\image.py", line 189, in getImageNames
    images = Image.getImageNamesAPI(config=config, session=session)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Python\Lib\site-packages\wikiteam3\dumpgenerator\dump\image\image.py", line 392, in getImageNamesAPI
    sha1 = image["sha1"]
           ~~~~~^^^^^^^^
KeyError: 'sha1'
yzqzss commented 1 year ago

Fixed 2 weeks ago: https://github.com/mediawiki-client-tools/mediawiki-scraper/commit/c6aa0ff2e356fd886c7d433fc20b8759fa15b5f7.

But I didn't make a PR for this commit :-(

robkam commented 1 year ago

That fixes it. Please do a PR. Also line 116 has typos "Failled to donwload".