jo1gi / audiobook-dl

Audiobook CLI downloader
GNU General Public License v3.0
248 stars 43 forks source link

audiobook-dl not working for everand #129

Open Juhayer-Al-Wasif opened 1 month ago

Juhayer-Al-Wasif commented 1 month ago

Command: pipx install --force audiobook-dl Output:

Installing to existing venv 'audiobook-dl'
⚠️  Note: audiobook-dl was already on your PATH at /usr/bin/audiobook-dl
  installed package audiobook-dl 0.7.3, installed using Python 3.12.6
  These apps are now globally available
    - audiobook-dl
done! ✨ 🌟 ✨

~ took 7s Command: audiobook-dl -c /home/wasif/Desktop/cookies-everand-com.txt https://www.everand.com/book/163636556/American-Gods-The-Tenth-Anniversary-Edition-A-Novel Output:

Finding compatible source
Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/audiobook_dl-0.7.3-py3.12.egg/audiobookdl/__main__.py", line 33, in main
  File "/usr/lib/python3.12/site-packages/audiobook_dl-0.7.3-py3.12.egg/audiobookdl/__main__.py", line 50, in process_url
  File "/usr/lib/python3.12/site-packages/audiobook_dl-0.7.3-py3.12.egg/audiobookdl/sources/__init__.py", line 28, in find_compatible_source
audiobookdl.exceptions.NoSourceFound

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/audiobook-dl", line 33, in <module>
    sys.exit(load_entry_point('audiobook-dl==0.7.3', 'console_scripts', 'audiobook-dl')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/audiobook_dl-0.7.3-py3.12.egg/audiobookdl/__main__.py", line 35, in main
  File "/usr/lib/python3.12/site-packages/audiobook_dl-0.7.3-py3.12.egg/audiobookdl/exceptions.py", line 33, in print
  File "/usr/lib/python3.12/site-packages/audiobook_dl-0.7.3-py3.12.egg/audiobookdl/logging.py", line 50, in print_error_file
  File "/usr/lib/python3.12/site-packages/audiobook_dl-0.7.3-py3.12.egg/audiobookdl/utils/__init__.py", line 37, in read_asset_file
  File "/usr/lib/python3.12/zipfile/_path/__init__.py", line 342, in read_text
    with self.open('r', encoding, *args, **kwargs) as strm:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/zipfile/_path/__init__.py", line 307, in open
    raise FileNotFoundError(self)
FileNotFoundError: /usr/lib/python3.12/site-packages/audiobook_dl-0.7.3-py3.12.egg/audiobookdl/assets/errors/no_source_found.txt
devnoname120 commented 1 month ago

Alternative:

  1. Install Widevine L3 Guessor
    • Read the README.md carefully. Among other things you will need to dump a CDM first or it won't work.
  2. Open the audiobook in Everand and start playing.
  3. Click on the Widevine L3 Guessor extension icon.
    1. The PSSH should already be filled, if not then press the Select button.
    2. The License URL should already be filled with https://lic.drmtoday.com/license-proxy-widevine/cenc/?specConform=true. If not, press the Select button and choose it.
    3. Change the Challenge scheme to CommonWV.
    4. Click on Guess!.
    5. The keys will appear in the Result box (one per line). Copy them for later.
  4. Open the Developer Tools of your web browser. In the Network tab search for .mpd and it should show a GET request. Click on it and then on Preview or Response and you should see some XML text.
    • If no requests appear then keep the Developer Tools open and reload the page.
    • Make sure to click on the GET request, not the OPTIONS request or you won't see anything.
  5. Find the <SegmentTimeline> of the bitrate you want, it should contain entries like <S d="123456" r="9876"></S>. Calculate 1 (for segment 96kbps-0.m4s) + the sum the r values in the <S> tags, assuming 1 if an r value is missing. In my case I have two <S> tags: <S d="123456" r="9876"></S> and <S d="65432"></S>. So the sum is 1 + d + 1 = 1 + 9876 + 1 = 9878. Remember that number, it corresponds to the total count of segments that we will need to download in a next step.
  6. Still in the Network tab search for .m4s and it should show some requests in the form of 96kbps-0.m4s, 96kbps-1.m4s, etc. or 128kbps-0.m4s, 128kbps-1.m4s, etc.
    1. Right-click on one of these requests and then Copy as cURL. In the copied command, replace the segment number in the URL with {} and add --output 128kbps-{}.m4s at the end of the command For example in my case I replace 128kbps-1.m4s with 128kbps-{}.m4s in the URL and I add --output 128kbps-{}.m4s at the end of the command.
    2. Run the following bash code to download all the segments (replace 9878 with the sum you calculated above):
      seq 0 9878 | xargs -n 1 -P 20 -I{} [Paste the curl command here] --max-time 10 --connect-timeout 5 --retry-connrefused --retry-delay 0 --retry 5 --retry-max-time 30 --output 128kbps-{}.m4s
    3. The segments should have been successfully downloaded. Note that even if the requests in the browser were 96kbps-xxx.m4s you can usually replace the 96kbps with 128kbps in the URL to improve the quality.
  7. To concatenate all the downloaded segments together you can execute it (replace 9878 with the sum you calculated before):
    seq 0 9878 | xargs -n 1 -P 1 -I{} cat 128kbps-{}.m4s >> 128kbps-concat.m4b
  8. Install Bento4 (we need its mp4decrypt command).
  9. Decrypt the concatenated file. Put a --key argument for each key that appeared in the Result box of the Widevine L3 Guessor extension. For example:
    mp4decrypt --show-progress --key xxxxxxxxxxxxxx:xxxxxxxxxxxx --key xxxxxxxxxxxxxx:xxxxxxxxxxxx --key [etc.] 128kbps-concat.m4b 128kbps-decrypt.m4b
  10. You should now be able to play 128kbps-decrypt.m4b without issues.
  11. (Optional) You can use something like https://github.com/sandreas/m4b-tool to e.g. fix the chapters if needed:
    m4b-tool chapters --adjust-by-silence -o 128kbps-decrypt-chapters.m4b 128kbps-decrypt.m4b