kemayo / leech

Turn a story on certain websites into an ebook for convenient reading
MIT License
154 stars 24 forks source link

TypeError while creating epub #54

Closed ChaoticWyrme closed 3 years ago

ChaoticWyrme commented 3 years ago

I just cloned the repo and tried to run the program, (using examples/practical1.json) and it crashed when it tried to create the epub:

Traceback (most recent call last):
  File "C:\Users\osbornm\Applications\leech\leech.py", line 160, in <module>
    cli()
  File "C:\Users\osbornm\AppData\Local\pypoetry\Cache\virtualenvs\leech-BD-tO-eE-py3.9\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\osbornm\AppData\Local\pypoetry\Cache\virtualenvs\leech-BD-tO-eE-py3.9\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "C:\Users\osbornm\AppData\Local\pypoetry\Cache\virtualenvs\leech-BD-tO-eE-py3.9\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\osbornm\AppData\Local\pypoetry\Cache\virtualenvs\leech-BD-tO-eE-py3.9\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\osbornm\AppData\Local\pypoetry\Cache\virtualenvs\leech-BD-tO-eE-py3.9\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "C:\Users\osbornm\Applications\leech\leech.py", line 155, in download
    filename = ebook.generate_epub(story, options, normalize=normalize)
  File "C:\Users\osbornm\Applications\leech\ebook\__init__.py", line 128, in generate_epub
    html.extend(chapter_html(story, normalize=normalize))
  File "C:\Users\osbornm\Applications\leech\ebook\__init__.py", line 89, in chapter_html
    contents = unicodedata.normalize('NFKC', contents)
TypeError: normalize() argument 2 must be str, not Tag

I think it's probably caused by the most recent commit 533c14f It can be fixed by calling --no-normalize, but that is just disabling the feature.