Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site support request: Spotify #10344

Open
4 of 8 tasks
Starsam80 opened this issue Aug 14, 2016 · 15 comments
Open
4 of 8 tasks

Site support request: Spotify #10344

Starsam80 opened this issue Aug 14, 2016 · 15 comments
Labels
account-needed site-support-request Add extractor(s) for a new domain

Comments

@Starsam80
Copy link
Contributor

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2016.08.13. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2016.08.13

Before submitting an issue make sure you have:

  • At least skimmed through README and most notably FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:

Add -v flag to your command line you run youtube-dl with, copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):

$ python -m youtube_dl https://play.spotify.com/user/starsam80/playlist/3Cwl7TvjAgsVvs1KF7jxbs --verbose
[debug] System config: []
[debug] User config: []
[debug] Command-line args: ['https://play.spotify.com/user/starsam80/playlist/3Cwl7TvjAgsVvs1KF7jxbs', '--verbose']
[debug] Encodings: locale UTF-8, fs utf-8, out UTF-8, pref UTF-8
[debug] youtube-dl version 2016.08.13
[debug] Git HEAD: aaf44a2
[debug] Python version 3.5.2 - Linux-4.7.0-1-ARCH-x86_64-with-arch-Arch-Linux
[debug] exe versions: ffmpeg 3.1.2, ffprobe 3.1.2, rtmpdump 2.4
[debug] Proxy map: {}
[generic] 3Cwl7TvjAgsVvs1KF7jxbs: Requesting header
WARNING: Falling back on generic information extractor.
[generic] 3Cwl7TvjAgsVvs1KF7jxbs: Downloading webpage
[generic] 3Cwl7TvjAgsVvs1KF7jxbs: Extracting information
ERROR: Unsupported URL: https://play.spotify.com/user/starsam80/playlist/3Cwl7TvjAgsVvs1KF7jxbs
Traceback (most recent call last):
  File "/home/starsam80/.local/lib/python3.5/site-packages/youtube_dl/YoutubeDL.py", line 691, in extract_info
    ie_result = ie.extract(url)
  File "/home/starsam80/.local/lib/python3.5/site-packages/youtube_dl/extractor/common.py", line 347, in extract
    return self._real_extract(url)
  File "/home/starsam80/.local/lib/python3.5/site-packages/youtube_dl/extractor/generic.py", line 2344, in _real_extract
    raise UnsupportedError(url)
youtube_dl.utils.UnsupportedError: Unsupported URL: https://play.spotify.com/user/starsam80/playlist/3Cwl7TvjAgsVvs1KF7jxbs

If the purpose of this issue is a site support request please provide all kinds of example URLs support for which should be included (replace following example URLs by yours):


Description of your issue, suggested solution and other information

Since there is support for Soundcloud, I don't see why Spotify can't be supported. The links above may be blocked by a simple login, but you can create a free account if needed. https://developer.spotify.com/ also looks useful.

@yan12125 yan12125 added site-support-request Add extractor(s) for a new domain account-needed labels Aug 14, 2016
@Starsam80
Copy link
Contributor Author

Starsam80 commented Aug 14, 2016

So I'm doing a bit of research on this, and it looks like an easy way to get metadata is by using https://api.spotify.com/v1/{tracks,artists,album,etc}/{id}. For example:

I don't know why, but even though my playlist is public, it need authentication... More information about the API here

Now I just have to figure out how Spotify encrypts their music. From what I can tell it downloads data from http://audio-mp3-fa.spotify.com/mp3enc/, but it does not download as a mp3 file. This is a file that I got when I tried to download a song (the file name means nothing).

Edit: Playlist support will probably come later. See comments below

@yan12125
Copy link
Collaborator

The Spotify API involves a pair of API key and API secret. In general it's not acceptable for youtube-dl as all sources codes are public, and API keys may be abused.

@Starsam80
Copy link
Contributor Author

Only user related stuff seem to use API keys, so things like getting info about a track using https://api.spotify.com/v1/tracks/ shouldn't be a problem from what I see. In other words, there will be no downloading playlists, only albums and tracks.

@yan12125
Copy link
Collaborator

Adding support for tracks and albums can be the first step.

@TRox1972
Copy link
Contributor

This may help

@Starsam80
Copy link
Contributor Author

jrnewell/spotify-ripper is now a 404... Spotify might have finally got to it. I wasn't going to go that route anyways, because after a quick search it seems like anything that relies on libspotify requires API keys and/or a premium account, so I thought that wasn't really good for youtube-dl. I know the gist of how Spotify requests and plays music via the web player, but with school I don't have much time to work on this. I do still plan on working on this whenever I have free time, I just don't know when.

Also, is there any websocket support in youtube-dl or should I start looking at reverse engineering other platforms such as the android app?

@sWAGrOGER
Copy link

Did you get far with this? as I have the audio file output. if you click this link >>
http://audio-mp3-fa.spotify.com/mp3enc/9f7f829930e4516a3171fd867d87f9626decbed8?1477596339_XDVYnfeR0YbNifpahH2peN1qF3y4+IASuT1dFAyGses=

It will output the audio file.

I've noticed 9f7f829930e4516a3171fd867d87f9626decbed8 stays in all the URL's I think anyway I've not tried another album or artist yet. I'm trying to figure out how to decrpt it and I think it might be base64 is it? not 100% sure on that, but more to the point, I wanna know how this lines up with the artist info you can pull from the API as if i can replicate the function that would be awesome failing that I have another idea and spotify won't even know I'm streaming from their site.

@Starsam80
Copy link
Contributor Author

Starsam80 commented Oct 27, 2016

Spotify ID's are base 62 (and only sometimes base 64? I don't know), and get converted to base 16 somewhere along the way (I have some notes on this here [note that this is incomplete and may even be wrong]). The files downloaded from audio-mp3-fa.spotify.com/mp3enc are encrypted and I haven't been able to figure out how to decrypt it yet because I don't have much time. Authentication uses web sockets and as far as I know youtube-dl doesn't support that yet, so I was thinking to decompile the android app, but I have no experience and it's obfuscated too, so that can take some time.

That's about all I figured out so far, and keep in mind, I have never done anything like this before, so a lot (if not, all) of this could be wrong

Edit (27/10/16): BTW, links from audio-mp3-fa.spotify.com/mp3enc only last for a bit before they expire. That's why there's a ? for some type of authentication. No idea how that works, but I do know that the web player gets the full link from communicating through the web socket.

Edit (01/01/17): I don't feel like making a new comment and notifying everybody, but I also want to let everybody know that I gave up on this long ago, so don't expect anything from me.

@ghost
Copy link

ghost commented Nov 19, 2018

@Starsam80
https://github.com/invicnaper/spotify-dl/blob/master/spotify-dl.py or https://github.com/Ritiek/Spotify-Downloader ?
it uses YT to download the audio, using Spotify's HTTP link 😁︎😁︎😁︎

@Rudloff
Copy link
Contributor

Rudloff commented Jul 2, 2019

Could code from https://github.com/ritiek/spotify-downloader be used for this?

@remitamine
Copy link
Collaborator

@Rudloff no:

show how Spotify's API can be exploited to download music from YouTube.

for that, you can simply go to Youtube Music and download from there.

@Fabian42
Copy link

If the login is the issue, then youtube-dl could just print an error message if no valid login information is provided and only even attempt to properly download songs if the -u and -p arguments are given.

@cisko99za
Copy link

cisko99za commented Oct 21, 2019

i don't understand how to use youtube-dl to down spoty playlist.... for win user... all repo above it is write on python for linux... and for win??
please post here valid code to down spoty playlist (example): https://open.spotify.com/playlist/37i9dQZF1DWSf2RDTDayIx)
and deezer??

@Fabian42
Copy link

  1. You cannot download anything from Spotify with youtube-dl, that's what this entire report is about.
  2. The programming language shouldn't matter for you and no, it works just as fine on Windows.

@cisko99za
Copy link

ok. how to down this playlist?
https://open.spotify.com/playlist/37i9dQZF1DWSf2RDTDayIx

@ytdl-org ytdl-org locked and limited conversation to collaborators Oct 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
account-needed site-support-request Add extractor(s) for a new domain
Projects
None yet
Development

No branches or pull requests

8 participants