Content-Length: 213193 | pFad | http://github.com/ReVanced/revanced-patches/issues/4447

99 feat: YouTube Music: Ask a user to login using spotify and then download their playlists, then upload them to YT Music · Issue #4447 · ReVanced/revanced-patches · GitHub
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

feat: YouTube Music: Ask a user to login using spotify and then download their playlists, then upload them to YT Music #4447

Open
3 tasks done
TechPro424 opened this issue Feb 12, 2025 · 0 comments
Labels
Feature request Requesting a new feature that's not implemented yet

Comments

@TechPro424
Copy link

Feature description

  • Ask a user to login using spotify
  • Ask them to create an app on the Spotify Developer Dashboard selecting the Web API as required (and Android, if required, not too sure)
  • Ask them to provide the client ID and secret
  • Use this library to authenticate the user and get the access code required to use the Spotify Web API
  • Use this npm package to generate the PoToken and visitorData (see Use dependencies from npm) (needed if wanting to save the playlists to the device locally)
  • Use the below snippet to get all of the user's Spotify Playlists
package org.example.app



import com.adamratzman.spotify.SpotifyScope
import com.adamratzman.spotify.SpotifyUserAuthorization
import com.adamratzman.spotify.endpoints.client.ClientPlaylistApi
import com.adamratzman.spotify.getSpotifyAuthorizationUrl
import com.adamratzman.spotify.models.Token
import com.adamratzman.spotify.spotifyClientApi
import com.github.felipeucelli.javatube.Search
import com.github.felipeucelli.javatube.Youtube


suspend fun main() {

    val spotifyClientSecret = "required"
    val spotifyClientId = "required"
   val authCode = "required"
    
    val poToken = "required"
    val visitorData= "required"
    

    val spotifyapi = spotifyClientApi(
        spotifyClientId,
        spotifyClientSecret,
        "http://127.0.0.1:9090",
        SpotifyUserAuthorization(token = Token(accessToken = authCode, expiresIn = 60 * 30, tokenType = "Bearer"))
    ).build()

    val playlistapi = ClientPlaylistApi(spotifyapi)
    val playlists = playlistapi.getClientPlaylists()
    for (playlist in playlists) {
       
        val fullplaylist = playlist.toFullPlaylist()
        val playlistname = fullplaylist?.name
        val playlistdescription = fullplaylist?.description
        val tracks = fullplaylist!!.tracks
        //Create a YT music playlist for the spotify playlist
        for (track in tracks) {
            val trackobj = track.track!!.asTrack
            val trackname = trackobj!!.name
            val artists = trackobj.artists
            val artistnamearray = ArrayList<String>()
            for (artist in artists) {
                artistnamearray.add(artist.name!!)
            }
            val artistnamesstring = artistnamearray.joinToString(separator = ", ")
            val searchterm = "$trackname $artistnamesstring"
            val firstresult = Search(searchterm).videosResults[0].url
           //Use the URL to get the video and add it to the playlist
            println(firstresult)
           //Save to device locally if needed
            val yt = Youtube(firstresult, true, true)
            yt.streams().onlyAudio.download("./downloads/")
        }

    }
}
Dependencies:

- "com.adamratzman:spotify-api-kotlin-core:4.1.3" https://github.com/adamint/spotify-web-api-kotlin
- 'com.github.felipeucelli:javatube:e6ad1872c7' (using jitpack) https://github.com/felipeucelli/JavaTube
  • Create a YT Music playlist corresponding to each Spotify playlist and upload the songs to the YT Music playlist (I'm not too fluent with the YouTube Data API, hence I was unable to prepare a usable snippet for that)

Motivation

As play on demand for Spotify is not a supported feature by ReVanced, Revanced's YT Music patches are currently the best option available for a near-perfect music player. However, as many people have playlists on Spotify with a large number of songs, it would be difficult for them to switch to Revanced, and this request, if added, would make it easier for people currently on Spotify to switch to Revanced.

Acknowledgements

  • I have checked all open and closed feature requests and this is not a duplicate
  • I have chosen an appropriate title.
  • All requested information has been provided properly.
@TechPro424 TechPro424 added the Feature request Requesting a new feature that's not implemented yet label Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature request Requesting a new feature that's not implemented yet
Projects
None yet
Development

No branches or pull requests

1 participant








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/ReVanced/revanced-patches/issues/4447

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy