m-haisham / novelsave

This is a tool to download and convert novels from popular sites to e-books.
Apache License 2.0
36 stars 7 forks source link

Can't package html and text #74

Closed idMysteries closed 2 years ago

idMysteries commented 2 years ago
novelsave package https://www.webnovel.com/book/warlock-of-the-magus-world-fan-fiction_19239303706899305 --target html
Acquired 'WARLOCK OF THE MAGUS WORLD FAN FICTION' (1) from database.
Traceback (most recent call last):
  File "d:\python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "d:\python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "D:\Python38\Scripts\novelsave.exe\__main__.py", line 7, in <module>
  File "d:\python38\lib\site-packages\novelsave\client\cli\main.py", line 71, in main
    cli()
  File "d:\python38\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "d:\python38\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "d:\python38\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "d:\python38\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "d:\python38\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "d:\python38\lib\site-packages\novelsave\client\cli\groups\_novel.py", line 26, in _package
    controllers.package(id_or_url, target, target_all)
  File "src/dependency_injector/_cwiring.pyx", line 28, in dependency_injector._cwiring._get_sync_patched._patched
  File "d:\python38\lib\site-packages\novelsave\client\cli\controllers\_package.py", line 41, in package
    path = packager.package(novel)
  File "d:\python38\lib\site-packages\novelsave\services\packagers\html_packager.py", line 58, in package
    toc = self.prepare_toc(novel, volumes)
  File "d:\python38\lib\site-packages\novelsave\services\packagers\html_packager.py", line 116, in prepare_toc
    for volume, chapters in sorted(volumes.items(), key=lambda v: v.index):
TypeError: '<' not supported between instances of 'builtin_function_or_method' and 'builtin_function_or_method'

EPUB is OK

idMysteries commented 2 years ago

TXT:

> novelsave package https://www.webnovel.com/book/warlock-of-the-magus-world-fan-fiction_19239303706899305 --target text
Acquired 'WARLOCK OF THE MAGUS WORLD FAN FICTION' (1) from database.
Traceback (most recent call last):
  File "d:\python38\lib\runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "d:\python38\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "D:\Python38\Scripts\novelsave.exe\__main__.py", line 7, in <module>
  File "d:\python38\lib\site-packages\novelsave\client\cli\main.py", line 71, in main
    cli()
  File "d:\python38\lib\site-packages\click\core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "d:\python38\lib\site-packages\click\core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "d:\python38\lib\site-packages\click\core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "d:\python38\lib\site-packages\click\core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "d:\python38\lib\site-packages\click\core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "d:\python38\lib\site-packages\novelsave\client\cli\groups\_novel.py", line 26, in _package
    controllers.package(id_or_url, target, target_all)
  File "src/dependency_injector/_cwiring.pyx", line 28, in dependency_injector._cwiring._get_sync_patched._patched
  File "d:\python38\lib\site-packages\novelsave\client\cli\controllers\_package.py", line 41, in package
    path = packager.package(novel)
  File "d:\python38\lib\site-packages\novelsave\services\packagers\text_packager.py", line 64, in package
    f.write(self.preface(novel, metadata, urls))
  File "d:\python38\lib\site-packages\novelsave\services\packagers\text_packager.py", line 90, in preface
    text += "by " + novel.author + self.endl
TypeError: can only concatenate str (not "NoneType") to str
m-haisham commented 2 years ago

I'll take a look. text option seems simple enough.

m-haisham commented 2 years ago

Fixed