ytdl-org / youtube-dl

Command-line program to download videos from YouTube.com and other video sites
http://ytdl-org.github.io/youtube-dl/
The Unlicense
131.36k stars 9.95k forks source link

Spotify return 400 error while downloading #32362

Open alimirjahani7 opened 1 year ago

alimirjahani7 commented 1 year ago

Checklist

Verbose log

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['--verbose', '-o', 'test.m4a', 'https://open.spotify.com/episode/6ebfRt2DgCd7MbHY3CAuZl?si=7FBcrmvBRlmoqWI19QwYHg%0A']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2021.12.17
[debug] Git HEAD: fa7f0effb
[debug] Python 3.9.17 (CPython x86_64 64bit) - Linux-5.19.0-45-generic-x86_64-with-glibc2.35 - OpenSSL 3.0.2 15 Mar 2022 - glibc 2.35
[debug] exe versions: ffmpeg 4.3.1, ffprobe 4.3.1
[debug] Proxy map: {}
[spotify] Downloading JSON metadata
[spotify] 6ebfRt2DgCd7MbHY3CAuZl: Downloading JSON metadata
ERROR: Unable to download JSON metadata: HTTP Error 400: Bad Request (caused by <HTTPError 400: 'Bad Request'>); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
  File "/home/ali/.virtualenvs/flowjib-backend/src/youtube-dl/youtube_dl/extractor/common.py", line 635, in _request_webpage
    return self._downloader.urlopen(url_or_request)
  File "/home/ali/.virtualenvs/flowjib-backend/src/youtube-dl/youtube_dl/YoutubeDL.py", line 2356, in urlopen
    return self._opener.open(req, timeout=self._socket_timeout)
  File "/usr/lib/python3.9/urllib/request.py", line 523, in open
    response = meth(req, response)
  File "/usr/lib/python3.9/urllib/request.py", line 632, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.9/urllib/request.py", line 561, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.9/urllib/request.py", line 494, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.9/urllib/request.py", line 641, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)

Description

spotify downloader won't work

WRITE DESCRIPTION HERE

dirkf commented 1 year ago

At the moment, and probably forever, this extractor doesn't work. See #31037.

ghost commented 1 year ago

this gets it:

https://spclient.wg.spotify.com/soundfinder/v1/unauth/episode/6ebfRt2DgCd7MbHY3CAuZl/com.widevine.alpha

contrary to the URL text, a clear stream is available under the key passthroughUrl:

https://sphinx.acast.com/p/open/s/63e39eb02e631f0011a284ac/e/64620c6df695d60011f6fa45/media.mp3

dirkf commented 1 year ago

This may be characteristic of an externally hosted episode. The JSON that OP fails to get would have a flag to identify that. yt-dl has an acast.com extractor, but I haven't studied it.

The problem URL here doesn't have a similar work-around using the soundfinder API. In fact the JWT-encoded hydration JSON in the page includes a .passthrough member with value "NONE", which is also returned in the soundfinder API result. There's no such member in the equivalent JSON from this problem page: actually the JSON is different overall.

ghost commented 1 year ago

thats interesting, but as I mentioned in the other thread, the full media for the other example is locked behind a login. so unless someone wants to provide me a login for testing, I am moving on to other stuff. its been reported that the other video is playable without DRM, so I think I could probably code it up if I have access to the tool to do so (an account).