jo1gi / audiobook-dl

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

Chirp: Error while making request to server (audiobookdl.exceptions.RequestError) #65

Open Andronian42 opened 1 year ago

Andronian42 commented 1 year ago

Installation method: pip (pip install audiobook-dl)

Version: python 3.12.0 (tags/v3.12.0:0fb18b0, Oct 2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)] audiobook-dl 0.7.0

Describe the bug Attempt at downloading from Chirp fails after getting a response from the server. Cookie txt file was just updated by me (using this extension on Firefox) so should be up-to-date. I've tried multiple different audiobooks from the site, including ones that I've downloaded through audiobook-dl before, and have gotten the same error.

Command output

PS Z:\drive2\Audiobook\.download> audiobook-dl -d -c Z:\cookies-chirpbooks-com.txt --output-format m4b https://www.chirpbooks.com/player/12327174
DEBUG audiobook-dl 0.7.0
DEBUG python 3.12.0 (tags/v3.12.0:0fb18b0, Oct  2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)]
 INFO Finding compatible source
 INFO Authenticating with chirp
DEBUG Loading cookies from 'Z:\cookies-chirpbooks-com.txt'
DEBUG Downloading result of https://www.chirpbooks.com/player/12327174
DEBUG Failed to download data from: https://www.chirpbooks.com/player/12327174
Response:
b'<!DOCTYPE html><html lang="en-US"><head><title>Just a moment...</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><meta http-equiv="X-UA-Compatible"
content="IE=Edge"><meta name="robots" content="noindex,nofollow"><meta name="viewport" content="width=device-width,initial-scale=1"><link href="/cdn-cgi/styles/challenges.css"
rel="stylesheet"><meta http-equiv="refresh" content="375"></head><body class="no-js"><div class="main-wrapper" role="main"><div class="main-content"><noscript><div
id="challenge-error-title"><div class="h2"><span class="icon-wrapper"><div class="heading-icon warning-icon"></div></span><span id="challenge-error-text">Enable JavaScript and cookies to
continue</span></div></div></noscript></div></div><script>(function(){window._cf_chl_opt={cvId: \'2\',cZone: "www.chirpbooks.com",cType: \'managed\',cNounce: \'29360\',cRay:
\'823ba11a6e77e259\',cHash: \'398fd114b97a7b4\',cUPMDTk: "\\/player\\/12327174?__cf_chl_tk=NFCgzh4GFz9gDkHgzKHoF5t36XUnEFzHZzT5oqsVoHM-1699591351-0-gaNycGzNDKU",cFPWv: \'g\',cTTimeMs:
\'1000\',cMTimeMs: \'375000\',cTplV: 5,cTplB: \'cf\',cK: "visitor-time",fa: "\\/player\\/12327174?__cf_chl_f_tk=NFCgzh4GFz9gDkHgzKHoF5t36XUnEFzHZzT5oqsVoHM-1699591351-0-gaNycGzNDKU",md:
"Gi5weDVHK7PeXhrwqAPO088qDdEHe733F7g85nEg.gc-1699591351-0-ASbuw_avuHFJEY-iiWJtWKA3sXUPrIiL9qAs8JHwDVAi4xTSO5EgzEWcLdbTWhg3i-nrWUjYTK1XJaP87Jt_jFWE0d4iWyKoznziSOMERqKs1NllptIu2yVJPF1qAewd1rX
6oVBPgQEe67bvXEh520L1KJKLorq-gRav_5NfGJHniGtPCOcN4H6XUpfvA2CJKOVUke5KVAo_270i-7Fqn5tFVlSsJXcPr4zq_6mS-OBJKQsbQNSV8THJ0gm3Ca3bMmy0f21Cc5LaxA2O9NxPKK8fdwU9a68u2Rsd0UIq_ui32OZ_4Uoc2pkjsAW5mqXC
taAOgq_X1lejEwtLR8rEm38g5MiqGzJ4RlnkJLFAwJsqNtbOuXIY7lns_SRFdt42cK_qwZvhzml8wynlikKRdzUAFl3J4jA_t01Dye2dBiNI1BTH1qcZ30-pI6KXaH95OOWdyHYaFHk_vy3W4lCUe6aZtfbhkb4ziy-6WgtdZRGeSeGLG7mAvYpyFBhoP
2Vq1SBz7PTVX4plCxDxRg2FEkT_OMwpgTf9xEWUroH7JNsuHw2oJ8slSLcohoYQD0nQVjrxtNMeyObWZ-uohiIpDtRJXnhhyEM7bV3qnHzfGCvjCddmR-DIOPCblvjKPBjYDQ4XgBZuTKYPVL4gHMxpiJqL-y2DQ2Y9TuLGEqQDNJcLSb9fiydsvQd5jc
1ERCvd-nIjorRlQlxv_RrtSVCNZlRaDqSYfveQhLm-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\',cT: Math.floor(Date.now() / 1000),m: \'8utByCbKS+XoIfCd3iu9E8t+8GjmeavC8iFoZLITkuc=\',i1:
\'lz2Q/yV9NXb3metB4+FG+w==\',i2: \'YlvsuCJeuc2psEV/hBrpZg==\',zh: \'Y2bLFLW8//0CywAGfr1u8fJ5lqFIwPuusDg+If3CYJY=\',uh: \'YE9XOpG5TeHmhA1zfs5mxC8CrRZzq2a/+r+OU7dliYQ=\',hh:
\'sznXXJzkrNMuaryFxrTQ0GkMcBJhn4v6vHXSgGTxOAY=\',}};var cpo = document.createElement(\'script\');cpo.src =
\'/cdn-cgi/challenge-platform/h/g/orchestrate/chl_page/v1?ray=823ba11a6e77e259\';window._cf_chl_opt.cOgUHash = location.hash === \'\' && location.href.indexOf(\'#\') !== -1 ? \'#\' :
location.hash;window._cf_chl_opt.cOgUQuery = location.search === \'\' && location.href.slice(0, location.href.length - window._cf_chl_opt.cOgUHash.length).indexOf(\'?\') !== -1 ? \'?\' :
location.search;if (window.history && window.history.replaceState) {var ogU = location.pathname + window._cf_chl_opt.cOgUQuery + window._cf_chl_opt.cOgUHash;history.replaceState(null, null,
"\\/player\\/12327174?__cf_chl_rt_tk=NFCgzh4GFz9gDkHgzKHoF5t36XUnEFzHZzT5oqsVoHM-1699591351-0-gaNycGzNDKU" + window._cf_chl_opt.cOgUHash);cpo.onload = function() {history.replaceState(null,
null, ogU);}}document.getElementsByTagName(\'head\')[0].appendChild(cpo);}());</script></body></html>'
ERROR: Error while making request to server
Traceback (most recent call last):
  File "C:\Users\[redacted]\AppData\Roaming\Python\Python312\site-packages\audiobookdl\__main__.py", line 32, in main
    process_url(url, options, config)
  File "C:\Users\[redacted]\AppData\Roaming\Python\Python312\site-packages\audiobookdl\__main__.py", line 54, in process_url
    result = source.download(url)
             ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\[redacted]\AppData\Roaming\Python\Python312\site-packages\audiobookdl\sources\chirp.py", line 21, in download
    book_id = int(self.find_elem_in_page(url, "div.user-audiobook", "data-audiobook-id"))
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\[redacted]\AppData\Roaming\Python\Python312\site-packages\audiobookdl\sources\source\__init__.py", line 116, in find_elem_in_page
    results = self.find_elems_in_page(url, selector, **kwargs)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\[redacted]\AppData\Roaming\Python\Python312\site-packages\audiobookdl\sources\source\__init__.py", line 132, in find_elems_in_page
    page: bytes = self._get_page(url, **kwargs)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\[redacted]\AppData\Roaming\Python\Python312\site-packages\audiobookdl\sources\source\__init__.py", line 103, in _get_page
    resp = self.get(url, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\[redacted]\AppData\Roaming\Python\Python312\site-packages\audiobookdl\sources\source\networking.py", line 33, in get
    raise exceptions.RequestError
audiobookdl.exceptions.RequestError
PS Z:\drive2\Audiobook\.download>
jo1gi commented 1 year ago

I think Chirp has introduced bot detection. I will see what I can do about it.

joshaconnor commented 1 year ago

same error here. i noticed a hidden recaptcha element in the html of the player, but idk if that was there before or not. wanted to comment to boost the issue too, but hopefully the captcha thing helps

joshaconnor commented 1 year ago

follow-up: after looking into it a bit more, i think they are using cloudflare protection, so integrating something like flaresolverr or another solution might solve this.

toonvank commented 5 months ago

same issue here