mikf / gallery-dl

Command-line program to download image galleries and collections from several image hosting sites
GNU General Public License v2.0
11.7k stars 953 forks source link

[baraag] 403 when attempting to download anything #6333

Closed nomakewan closed 1 week ago

nomakewan commented 1 week ago

When attempting to download from Baraag, am getting a 403. This only appears to happen on Baraag as testing against a different Mastodon instance (fedibird) worked perfectly fine. Verbose output of error:

[gallery-dl][debug] Version 1.27.6 - Executable (stable/windows)
[gallery-dl][debug] Python 3.8.10 - Windows-7-6.1.7601-SP1
[gallery-dl][debug] requests 2.32.3 - urllib3 2.1.0
[gallery-dl][debug] Configuration Files ['H:\\Gallery-DL\\gallery-dl.conf']
[gallery-dl][debug] Starting DownloadJob for 'https://baraag.net/@test'
[baraag][debug] Using MastodonUserExtractor for 'https://baraag.net/@test'
[urllib3.connectionpool][debug] Starting new HTTPS connection (1): baraag.net:443
[urllib3.connectionpool][debug] https://baraag.net:443 "GET /api/v1/accounts/lookup?acct=test HTTP/1.1" 403 None
[urllib3.connectionpool][debug] Resetting dropped connection: baraag.net
[urllib3.connectionpool][debug] https://baraag.net:443 "GET /api/v1/accounts/search?q=%40test%40baraag.net&limit=1 HTTP/1.1" 403 None
[baraag][error] Unable to download data:  JSONDecodeError: Expecting value: line 1 column 1 (char 0)
[baraag][debug] 
Traceback (most recent call last):
  File "requests\models.pyc", line 974, in json
  File "json\__init__.pyc", line 357, in loads
  File "json\decoder.pyc", line 337, in decode
  File "json\decoder.pyc", line 355, in raw_decode
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "gallery_dl\job.pyc", line 151, in run
  File "gallery_dl\extractor\mastodon.pyc", line 35, in items
  File "gallery_dl\extractor\mastodon.pyc", line 132, in statuses
  File "gallery_dl\extractor\mastodon.pyc", line 244, in account_id_by_username
  File "gallery_dl\extractor\mastodon.pyc", line 275, in account_search
  File "gallery_dl\extractor\mastodon.pyc", line 326, in _call
  File "requests\models.pyc", line 978, in json
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

See also #6131

It should be noted that I can access it just fine from my browser, and that gallery-dl.conf contains my browser's user-agent by default for all extractors. Likewise, testing other Mastodon instances (including the not-officially-supported one listed above) seems to work fine.

mikf commented 1 week ago

and that gallery-dl.conf contains my browser's user-agent by default for all extractors

You also need the baraag cf_clearance cookie, as this is 403 error is caused by a Cloudflare challenge page.

nomakewan commented 1 week ago

I tried manually adding the value to the baraag extractor as such:

"cookies": {"cf_clearance": "VALUE_WENT_HERE"}

And also tried --cookies-from-browser firefox. Both resulted in the exact same verbose dump as above.

mikf commented 1 week ago

Seems to be working again.

nomakewan commented 1 week ago

Confirmed that it is magically working again. Going to close this tentatively and keep an eye on things. Thank you very much for your assistance!

juanker-cso commented 1 week ago

I am too having this issue after successfully being able to download stuff around 4 hours ago, but I'm also having issues on the webpage itself (opening a link in a new tab opens an empty page instead). News there mention an issue with loads and having broken access from apps as a temporary measure.

nomakewan commented 1 week ago

Aha! That news post certainly explains what is going on. Essentially they killed the API on baraag due to traffic overwhelming their systems. Excellent, looking forward to their hardware upgrade! Thank you for reporting this!