ScottBot10 / calibre_annas_archive

Calibre store plugin for Anna's Archive
74 stars 2 forks source link

Downloads that pull from libgen are met with 404 error #3

Open brennanmuir opened 6 months ago

brennanmuir commented 6 months ago

Search for a book, begins to download using libgen link, download fails with 404 error. When I use the libgen link provided in the error, I reach a forbidden page.

calibre, version 7.5.1 (linux, embedded-python: True)
Failed to download e-book: Failed: Downloading Harry Potter and the Sorcerer's Stone.libgen.li.epub

Starting job: Downloading Harry Potter and the Sorcerer's Stone.libgen.li.epub 
Job: "Downloading Harry Potter and the Sorcerer's Stone.libgen.li.epub" failed with error: 
Traceback (most recent call last):
  File "calibre/gui2/threaded_jobs.py", line 82, in start_work
  File "calibre/gui2/ebook_download.py", line 84, in __call__
  File "calibre/gui2/ebook_download.py", line 100, in _download
  File "calibre/gui2/ebook_download.py", line 67, in download_file
  File "mechanize/_mechanize.py", line 257, in open
  File "mechanize/_mechanize.py", line 313, in _mech_open
mechanize._response.get_seek_wrapper_class.<locals>.httperror_seek_wrapper: HTTP Error 404: Not Found

Called with args: (<calibre.gui2.ui.Main object at 0x15096a951cf0>, None, 'http://libgen.li/https://cdn2.booksdl.org\\get.php?md5=f3c217db4187442b3751070ef7d90e4a&key=8B0ATCEIGBQ9KOHI', "Harry Potter and the Sorcerer's Stone.libgen.li.epub", '', True, [], <bound method StorePlugin.create_browser of <calibre_plugins.store_annas_archive.annas_archive.AnnasArchiveStore object at 0x1509358d4710>>) {'notifications': <queue.Queue object at 0x15090fb7c1d0>, 'abort': <threading.Event at 0x15090f93d110: unset>, 'log': <calibre.utils.logging.GUILog object at 0x15090fb7e450>} 
Princeofthebow commented 6 months ago

I am met with a very similar error, using Calibre 5.12. on Debian as well. Can post Error message if needed.

Princeofthebow commented 6 months ago

I think the issues is around here https://github.com/ScottBot10/calibre_annas_archive/blob/eac3aff2debcb991c66d0e81d0cdf19dd66d8d33/annas_archive.py#L157

if I am reading your code correctly, @ScottBot10 the way tou handle the link prefix is the issue.

@brennanmuir I have no direct experience with plugin development but if all is lost I can try to sort this out. Do you have experience?