A Flask based backend to search & download music from Spotify
Project description
spotify-flask-downloader
A Flask Based Backend To Search And Download Music From Spotify.
This is a little flask based backend to download music from YouTube by searching in Spotify, based on your network requests.
Install
pip3 install spotify-flask-downloader
Dependencies
Like the module?
Consider starring the repository. Feel free to use.
Feel free to open issue, in case you find one.
Usage
Start the server
Execute this script and let it run in the background as you play with this module.
from spotifyflaskdownloader import SpotifyFlaskDownloader
downloader = SpotifyFlaskDownloader("SPOTIFY-CLIENT-ID", "SPOTIFY-CLIENT-SECRET", 5000)
You can use something like requests or urllib to access this flask server.
Download Track
import requests
response = requests.get(
"http://localhost:5000/trackdownload",
params= {
"track_id": "7gHs73wELdeycvS48JfIos" #Alternatively you can provide "track_name" in place of "track_id"
}
)
print(response.json())
- Response
{
"download_url": "https://r8---sn-gwpa-5bgs.googlevideo.com/videoplayback?expire=1594409257&ei=yWwIX_3rNJOWvQSFwI5A&ip=2409%3A4053%3A2196%3Ad6fa%3Ac8bf%3Ab2d8%3A81bb%3Aad05&id=o-AE3zCFHWH5aAUBwVqKVBijX3Vjd9xf4LSZ5uyIa8l2qY&itag=249&source=youtube&requiressl=yes&mh=Hp&mm=31%2C29&mn=sn-gwpa-5bgs%2Csn-gwpa-qxa6&ms=au%2Crdu&mv=m&mvi=8&pl=36&initcwndbps=175000&vprv=1&mime=audio%2Fwebm&gir=yes&clen=1360728&dur=212.501&lmt=1576159977750934&mt=1594387597&fvip=8&keepalive=yes&c=WEB&txp=5531432&sparams=expire%2Cei%2Cip%2Cid%2Citag%2Csource%2Crequiressl%2Cvprv%2Cmime%2Cgir%2Cclen%2Cdur%2Clmt&lsparams=mh%2Cmm%2Cmn%2Cms%2Cmv%2Cmvi%2Cpl%2Cinitcwndbps&lsig=AG3C_xAwRAIgP_4WHdnJO0h1wde12DLTcrfAQ8ShLLIezFkfO0AjRdoCIBqTZqhOP8kp7amBJObCMzKNJ_vzXZdvJcnY8j4PTAm0&sig=AOq0QJ8wRgIhAJe-DBmBKmfBx8dJcoKyp_WCeXg3Q3WKfxAvw4ztUwbVAiEApLFfh9DK9rRkkSRDSqPhXgUXdtStDUZOok2gxzEHhTY=&ratebypass=yes"
}
Search for Music
import requests
response = requests.get(
"http://localhost:5000/search",
params= {
"keyword": "Faded Alan Walker", #Search Query
"mode": "track", #Default is "album", Supports "album" & "track"
"offset": 0, #Default is 0
"limit": 1 #Default is 50
}
)
print(response.json())
- Response
{
"tracks": [
{
"track_id": "7gHs73wELdeycvS48JfIos",
"track_name": "Faded",
"track_artists": [
"Alan Walker"
],
"track_number": 1,
"track_duration": 212626,
"album_id": "5HMjpBO0v78ayq5lreAyDd",
"album_name": "Faded",
"year": "2015",
"album_artists": [
"Alan Walker"
],
"album_art_640": "https://i.scdn.co/image/ab67616d00001e02c4d00cac55ae1b4598c9bc90",
"album_art_300": "https://i.scdn.co/image/ab67616d0000b273c4d00cac55ae1b4598c9bc90",
"album_art_64": "https://i.scdn.co/image/ab67616d00004851c4d00cac55ae1b4598c9bc90",
"album_length": 4,
"album_type": "single"
}
]
}
Get Track Info
import requests
response = requests.get(
"http://localhost:5000/trackinfo",
params= {
"track_id": "7gHs73wELdeycvS48JfIos",
}
)
print(response.json())
- Response
{
"track_id": "7gHs73wELdeycvS48JfIos",
"track_name": "Faded",
"track_artists": [
"Alan Walker"
],
"track_number": 1,
"track_duration": 212626,
"album_art_640": "https://i.scdn.co/image/ab67616d00001e02c4d00cac55ae1b4598c9bc90",
"album_art_300": "https://i.scdn.co/image/ab67616d0000b273c4d00cac55ae1b4598c9bc90",
"album_art_64": "https://i.scdn.co/image/ab67616d00004851c4d00cac55ae1b4598c9bc90",
"album_id": "5HMjpBO0v78ayq5lreAyDd",
"album_name": "Faded",
"year": "2015",
"album_artists": [
"Alan Walker"
],
"album_length": 4,
"album_type": "single"
}
Get Tracks Of An Album
import requests
response = requests.get(
"http://localhost:5000/albuminfo",
params= {
"album_id": "5HMjpBO0v78ayq5lreAyDd",
}
)
print(response.json())
- Response
{
"tracks": [
{
"track_id": "7gHs73wELdeycvS48JfIos",
"track_name": "Faded",
"track_artists": [
"Alan Walker"
],
"track_number": 1,
"track_duration": 212626
},
{
"track_id": "0HmONWWIU1FXkwWLDpqrjl",
"track_name": "Faded - Instrumental",
"track_artists": [
"Alan Walker"
],
"track_number": 2,
"track_duration": 214013
},
{
"track_id": "34F4GJFUzPvPJmGrTpyqlZ",
"track_name": "Faded (Restrung)",
"track_artists": [
"Alan Walker"
],
"track_number": 3,
"track_duration": 217053
},
{
"track_id": "0RLjnX1vYWvtdThB8LABwo",
"track_name": "Faded - Piano Version",
"track_artists": [
"Alan Walker"
],
"track_number": 4,
"track_duration": 215080
}
]
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for spotify-flask-downloader-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6c1331868b4ded821890c0550d6077b78eb8edcfd5ad3a9bdbb763ca11a5c7c7 |
|
MD5 | cf124f390a17ce4c68d10921e3691a51 |
|
BLAKE2b-256 | 687062026ccd2bc021cc4a23a1abc05c2105b9741c3a768452a8977abd72dd38 |
Close
Hashes for spotify_flask_downloader-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08c2171eecc50d73f3e562636bf3ad92150c0621bd9d09a6202dc66961df4c75 |
|
MD5 | 4def697c9afa982038794cb9b94f6d73 |
|
BLAKE2b-256 | 0523627d983808e738c545244667a0909cdc28fda7fa4612f6f1c5fe9a75c1e4 |