MiniGlome / Archive.org-Downloader

Python3 script to download archive.org books in PDF format
859 stars 116 forks source link

img2pdf not able to converty #109

Open lucas-ljb opened 6 months ago

lucas-ljb commented 6 months ago

C:\Users\Lucas> python "C:\Users\Lucas\Archive.org-Downloader\archive-org-downloader.py" -e "EMAIL@SITE" -p "PASSWORD!" -r 0 -u "https://archive.org/details/bibletarot0000cori/" 1 Book(s) to download [+] Successful login

Current book: https://archive.org/details/bibletarot0000cori [+] Successful loan [+] Found 292 pages Downloading pages... 100%|████████████████████████████████████████████████████████████████████████████████| 292/292 [00:24<00:00, 12.04it/s] Traceback (most recent call last): File "C:\Users\Lucas\Archive.org-Downloader\archive-org-downloader.py", line 267, in pdf = img2pdf.convert(images, **pdfmeta) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Lucas\AppData\Roaming\Python\Python312\site-packages\img2pdf.py", line 2651, in convert pdf = pdfdoc( ^^^^^^^ File "C:\Users\Lucas\AppData\Roaming\Python\Python312\site-packages\img2pdf.py", line 742, in init v = ("D:" + datetime_to_pdfdate(v)).encode("ascii") ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Lucas\AppData\Roaming\Python\Python312\site-packages\img2pdf.py", line 725, in datetime_to_pdfdate return dt.astimezone(tz=timezone.utc).strftime("%Y%m%d%H%M%SZ") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ OSError: [Errno 22] Invalid argument

I am able to call img2pdf on cmd but when Archive downloader tries it fails

ali7mrd commented 6 months ago

Running the "pip install -r requirements.txt" command again solved the issue for me.

Raradra commented 2 months ago

I have the same issue. Unfortunately, running the "pip install -r requirements.txt" command again didn't help.

asheroto commented 1 month ago

Same issue here. Looksl ike the jpg images are actually downloaded, but the PDF is not created.

Details

``` Traceback (most recent call last): File "C:\tools\Archive.org-Downloader\archive-org-downloader.py", line 267, in pdf = img2pdf.convert(images, **pdfmeta) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python312\Lib\site-packages\img2pdf.py", line 2651, in convert pdf = pdfdoc( ^^^^^^^ File "C:\Python312\Lib\site-packages\img2pdf.py", line 742, in __init__ v = ("D:" + datetime_to_pdfdate(v)).encode("ascii") ^^^^^^^^^^^^^^^^^^^^^^ File "C:\Python312\Lib\site-packages\img2pdf.py", line 725, in datetime_to_pdfdate return dt.astimezone(tz=timezone.utc).strftime("%Y%m%d%H%M%SZ") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ OSError: [Errno 22] Invalid argument ```

asheroto commented 1 month ago

Got it figured out in #120.

Here's a link to the fixed version: https://github.com/asheroto/Archive.org-Downloader/blob/patch-5/archive-org-downloader.py