mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2024-11-23 20:11:07 +00:00
Added spotify downloader (#195)
Co-authored-by: Ayush Bhardwaj <classicayush@gmail.com>
This commit is contained in:
parent
957f7ab45c
commit
e3db5f71f2
|
@ -165,6 +165,7 @@ So far, the following projects have been integrated to this repo:
|
|||
|[IMDBQuerier](IMDBQuerier)|[Burak Bekci](https://github.com/Bekci)
|
||||
|[URL shortener](url_shortener)|[Sam Ebison](https://github.com/ebsa491)
|
||||
|[2048](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/2048)|[Krunal](https://github.com/gitkp11)
|
||||
|[Spotify Downloader](spotify_downloader)|[Sagar Patel](https://github.com/sagar627)|
|
||||
|[Download Page as PDF](https://github.com/hastagAB/Awesome-Python-Scripts/tree/master/Download-page-as-pdf)|[Jeremias Gomes](https://github.com/j3r3mias)
|
||||
|
||||
|
||||
|
|
32
spotify_downloader/README.md
Normal file
32
spotify_downloader/README.md
Normal file
|
@ -0,0 +1,32 @@
|
|||
- Downloads music from YouTube as an MP3 file.
|
||||
- Applies basic on metadata like track name, track number, album, genre and more.
|
||||
<br><br>
|
||||
You need to download ffmpeg to use this tool, download it from:
|
||||
1. [MacOs](https://evermeet.cx/ffmpeg/)
|
||||
2. [Windows](https://www.gyan.dev/ffmpeg/builds/)
|
||||
3. [Linux](https://johnvansickle.com/ffmpeg/)
|
||||
4. [Central Release Page](https://ffmpeg.org/download.html)
|
||||
<br><br>
|
||||
# Installation
|
||||
```
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
OR
|
||||
```
|
||||
pip3 install -r requirements.txt
|
||||
```
|
||||
# Usage
|
||||
To download a song run,
|
||||
|
||||
python3 spotify.py $trackUrl
|
||||
python3 spotify.py https://open.spotify.com/track/08mG3Y1vljYA6bvDt4Wqkj?si=SxezdxmlTx-CaVoucHmrUA
|
||||
|
||||
To download an album run,
|
||||
|
||||
python3 spotify.py $albumUrl
|
||||
python3 spotify.py https://open.spotify.com/album/2YMWspDGtbDgYULXvVQFM6?si=gF5dOQm8QUSo-NdZVsFjAQ
|
||||
|
||||
To download a playlist run,
|
||||
|
||||
python3 spotify.py $playlistUrl
|
||||
python3 spotify.py https://open.spotify.com/playlist/37i9dQZF1DWXhcuQw7KIeM?si=xubKHEBESM27RqGkqoXzgQ
|
1
spotify_downloader/requirements.txt
Normal file
1
spotify_downloader/requirements.txt
Normal file
|
@ -0,0 +1 @@
|
|||
spotdl==2.2.2
|
29
spotify_downloader/spotify.py
Normal file
29
spotify_downloader/spotify.py
Normal file
|
@ -0,0 +1,29 @@
|
|||
import spotdl
|
||||
import sys,os
|
||||
def spotify():
|
||||
if(len(sys.argv) <= 1):
|
||||
print("try 'python3 spotify.py -h' for help")
|
||||
return 1
|
||||
elif(sys.argv[1] == '-h'):
|
||||
print("To download a song run,\n python3 spotify.py $trackUrl\n\nTo download an album run,\n python3 spotify.py $albumUrl\n\nTo download a playlist run,\n python3 spotify.py $playlistUrl")
|
||||
return 1
|
||||
url = sys.argv[1]
|
||||
if (url.find('track') > -1):
|
||||
os.system(f'spotdl --song {url}')
|
||||
else:
|
||||
# Playlist
|
||||
if (url.find('playlist') > -1):
|
||||
os.system(f"spotdl -p {url} --write-to playlist.txt")
|
||||
os.system(f"spotdl --list playlist.txt")
|
||||
# Artist
|
||||
if (url.find('artist') > -1):
|
||||
os.system(f"spotdl --all {url} --write-to artist.txt")
|
||||
os.system(f"spotdl --list artist.txt")
|
||||
# album
|
||||
if (url.find('album') > -1):
|
||||
os.system(f"spotdl -a {url} --write-to album.txt")
|
||||
os.system(f"spotdl --list album.txt")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
spotify()
|
Loading…
Reference in New Issue
Block a user