whoeevee / EeveeSpotify

A tweak to get Spotify Premium for free, just like Spotilife
2.8k stars 210 forks source link

[Question] What about downloading and storing tracks locally? #234

Closed acquitelol closed 3 months ago

acquitelol commented 3 months ago

You mentioned in the README that implementing features such as playlist downloading is not possible because it's server sided, but I propose the following idea:

  1. Use the lyrics service to get a UUID of the song such that it can be found on YouTube or any service where it can be downloaded without the Widevine DRM to prevent playback
  2. Download the song as an MP3 in the highest bitrate allowed by the service, and organize it into a folder in Spotify's Documents directory with the playlist name, or something in that nature
  3. When the user goes offline and attempts to start playback, first try to find the song in that Documents directory, and if it exists play that instead, otherwise notify the song wasn't or couldn't be downloaded

This, of course, sounds easy on paper, but I believe it should definitely be possible. If it's too much of a hassle I can look into trying to find a robust way to do this myself :3

acquitelol commented 3 months ago

I didn't read the last part - nevermind lmao.

I'll open a PR eventually with my findings.

yodaluca23 commented 3 months ago

Hey @acquitelol love your work on Discord mods btw.

If you could implement actually downloading from Spotify instead like how Zotify works, I think this would be better.

https://github.com/whoeevee/EeveeSpotify/issues/177#issuecomment-2151244624

whoeevee commented 3 months ago

It would be nice if you could implement the downloading feature as natively as possible. You can add additional settings, etc., but the playback must be seamless and not occur from a third-party menu. Additionally, songs should be shown as downloaded in playlists.

acquitelol commented 3 months ago

It would be nice if you could implement the downloading feature as natively as possible. You can add additional settings, etc., but the playback must be seamless and not occur from a third-party menu. Additionally, songs should be shown as downloaded in playlists.

Yeah, of course. When it's done I'm hoping it'll look exactly the same in the front-end as if it was downloaded natively. I'm not quite sure if an external API will be needed or not yet because I may be able to use the fact that songs can be played at will without premium to download a pure mp3 without DRM, but I'll have to look into it further

acquitelol commented 3 months ago

Hey @acquitelol love your work on Discord mods btw.

If you could implement actually downloading from Spotify instead like how Zotify works, I think this would be better.

#177 (comment)

My idea is to swizzle the Download Playlist button, and then it'll create a JSON file in the Documents directory that holds the playlist UUID and then an array containing the UUID of every song in the playlist, then it will save the song file itself in a different directory with the name of the file being the UUID of the song.

At app start, if there is an internet connection and the user has chosen to do so, the code should try to sync every playlist with the json file to ensure it has the updated information, downloading any new songs as needed. Then, at offline playback time, it will just search for the UUID in the folder of mp3 files. If it finds it, then it will play that instead. If it doesn't, then it'll report an EeveeSpotify error or something.

You should be able to select whether you want playlists to be automatically synced or not, and if so, how often to do so (every app start being the most frequent, once every 6 months being the least frequent).

I believe every song also has a "download this song" button when you have premium but I don't remember if it does or not. If it doesn't then I might add it and it would simply save the song in the folder of mp3 files allowing you to play it whenever you're offline without it needing to be in a playlist.

I'm not sure whether it would be a good idea to be able to delete specific downloaded songs or just delete everything all at once, I may add both.

I'm open to suggestions!

TNT599 commented 3 months ago

Seems theoretically possible and feasible, only thing I want to mention is Zotify and similar are just python scripts which I don't know how easy that is to run on ios and if they need to be translated into swift or something else to work. Might be easier to use the youtube based online ones especially if there's one with an easy to work with API.

yodaluca23 commented 3 months ago

Seems theoretically possible and feasible, only thing I want to mention is Zotify and similar are just python scripts which I don't know how easy that is to run on ios and if they need to be translated into swift or something else to work.

Well yes, the implementation would have to be ported to swift, but the logic should be the same...

Might be easier to use the youtube based online ones especially if there's one with an easy to work with API.

Cobalt tools has a good API, but I think it would be infinitely better to download directly from Spotify, as that will have higher quality, ensure your getting the right song, and have the lyrics match properly (as YouTube downloads probably have intros and stuff), as well as others...

Richard-NDC commented 2 months ago

Hi there, i just find out some projects that can help you with native download (download from youtube)

NotDarkn commented 2 months ago

Hi there, i just find out some projects that can help you with native download (download from youtube)

tbf, downloading from YouTube is not the best idea mainly due to the fact that you could be downloading songs that have some weird into at the beginning or an outro at the end (depending on the song).

as @yodaluca23 said, "it would be infinitely better to download directly from Spotify"

Richard-NDC commented 2 months ago

Hi there, i just find out some projects that can help you with native download (download from youtube)

tbf, downloading from YouTube is not the best idea mainly due to the fact that you could be downloading songs that have some weird into at the beginning or an outro at the end (depending on the song).

as @yodaluca23 said, "it would be infinitely better to download directly from Spotify"

but we don’t know how to download it directly from spotify so youtube is the easiest way

yodaluca23 commented 2 months ago

Hi there, i just find out some projects that can help you with native download (download from youtube)

tbf, downloading from YouTube is not the best idea mainly due to the fact that you could be downloading songs that have some weird into at the beginning or an outro at the end (depending on the song).

as @yodaluca23 said, "it would be infinitely better to download directly from Spotify"

but we don’t know how to download it directly from spotify so youtube is the easiest way

Go look at Zotify source code...

https://github.com/zotify-dev/zotify

yodaluca23 commented 2 months ago

Go look at Zotify source code...

zotify-dev/zotify

Mainly https://github.com/zotify-dev/zotify/blob/21ef30844b2b2588f9e6db8e6e86423699730f92/zotify/track.py#L145 to the end of that file...

Richard-NDC commented 2 months ago

Go look at Zotify source code... zotify-dev/zotify

Mainly https://github.com/zotify-dev/zotify/blob/21ef30844b2b2588f9e6db8e6e86423699730f92/zotify/track.py#L145 to the end of that file...

i can read python but i can’t code swift, so can your team do it?

igor199592 commented 2 months ago

problem spotify not working, Even the usual version of spotify 8.9.64, music has become not available everywhere, even in favorites

An0n-00 commented 2 months ago

Hey Everyone

it would be infinitely better to download directly from Spotify

I totally agree. What I've noticed in the last weeks, is that Spotify cashes songs locally and waits for internet connection to "release" the song from cash. I think this would be possible to circumvent. One would have to implement a local server and when the server recognizes that the user is offline, it jumps into action and acts as Spotify's backend. [That this works, you would have to listen the song before going offline oc.] What do y'all think?

Kassra1 commented 1 month ago

I don't have anywhere to put my downloaded mp3s into on my files app there's no Spotify document so I have no where to put it in and I don't have local files anymore. Reply is appreciated. Thank you

yodaluca23 commented 1 month ago

I don't have anywhere to put my downloaded mp3s into on my files app there's no Spotify document so I have no where to put it in and I don't have local files anymore. Reply is appreciated. Thank you

That's not related to this and you already made an issue.

Kassra1 commented 1 month ago

I don't have anywhere to put my downloaded mp3s into on my files app there's no Spotify document so I have no where to put it in and I don't have local files anymore. Reply is appreciated. Thank you

That's not related to this and you already made an issue.

Why's it not related the post is about downloaded mp3s which is what my issue is based around

ElliotCHEN37 commented 1 month ago

We are talking about Spotify’s native downloading (A server-side Premium feature), not downloading our own MP3 into Spotify (A freeware feature). They’re different.

Kassra1 @.***>於 2024年10月7日 週一,07:22寫道:

I don't have anywhere to put my downloaded mp3s into on my files app there's no Spotify document so I have no where to put it in and I don't have local files anymore. Reply is appreciated. Thank you

That's not related to this and you already made an issue.

Why's it not related the post is about downloaded mp3s which is what my issue is based around

— Reply to this email directly, view it on GitHub https://github.com/whoeevee/EeveeSpotify/issues/234#issuecomment-2395627021, or unsubscribe https://github.com/notifications/unsubscribe-auth/A2CLRXVWTDPR66V4MFN5RZDZ2HAZZAVCNFSM6AAAAABKTJLKSWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGOJVGYZDOMBSGE . You are receiving this because you are subscribed to this thread.Message ID: @.***>

littleblack111 commented 2 weeks ago

I want to propose an idea. What about since they need to download/cache the player, we just don't remove the cache, and as for downloading, we can just trick the server into thinking we're listening to the music, and never remove the cached music.

I know it's cached Becuz I was on a flight where the WiFi can only access their internal service(movie etc) and Spotify says it's offline but some music that I'm previously listening to still plays

nyakokitsu commented 1 week ago

Zotify uses Librespot to download tracks, it receives streams and saves them into audio files

An0n-00 commented 1 week ago

I want to propose an idea. What about since they need to download/cache the player, we just don't remove the cache, and as for downloading, we can just trick the server into thinking we're listening to the music, and never remove the cached music.

lol that is literally what i said here:

https://github.com/whoeevee/EeveeSpotify/issues/234#issuecomment-2333404367

but I totally agree. it should be possible somehow...

littleblack111 commented 1 week ago

oh i see, sry for the dupe lol