Skip to content

Scrape your Spotify playlist, search YouTube for the top lyrical video and download the audio to your Music folder!

License

Notifications You must be signed in to change notification settings

Alex0Blackwell/music-downloader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Music Downloader

Table of contents

Overview

Download all the songs from your Spotify playlist by just pasting in the link! This program will scrape all the songs from a Spotify playlist and put it in a folder in your music directory named after the playlist. Additionally, individual songs can be added to a text prompt and those songs will be downloaded.

Examples

Screenshots

Downloading the songs from my spotify playlist "I can't. I'm a gamer now"

Screenshot

The folder that is made when downloading from a playlist

Folder

Technologies

  • Python -3.8
  • beatifulsoup4 -4.9
    • For scraping data from the Spotify website
  • selenium -3.141
    • Because Spotify needs the site to load JavaScript to display content
  • youtube-dl -2020.6.6
    • For downloading videos from YouTube
  • PySimpleGUI -4.28
    • For the Graphical User Interface

Setup

To run this project, first install the requirements: On Linux:

pip3 install -r requirements

On Windows:

pip install -r requirements

Note that Selenium requires a driver associated with your browser of choice, which can be downloaded off the Selenium website.

  • Firefox driver (geckodriver)
  • Chrome driver (ChromeDriver)
  • Opera driver (operachromiumdriver)
  • Safari driver (WebDriver)
  • Edge driver (Microsoft Edge Driver)
  • Internet Explorer driver (IEDriverServer)

The path to the driver must be specified, in my code this is done on line 8 and the syntax is slightly different for different browsers.
For example using Firefox the line reads:

browser = webdriver.Firefox(executable_path='/path/to/geckodriver')

While using Chrome requires:

driver = webdriver.Chrome('/path/to/chromedriver')

Note that if the driver is placed in /usr/bin or /usr/local/bin the argument giving the path to the driver is not needed.
In my case I'm using FireFox, which uses geckodriver to run Selenium.
Note that you must change line 11 in musicDownloader.py to match your browser and Selenium driver path

Once the Selenium drivers are installed, and the musicDownloader.py code is updated, run the python file with: On Linux: python musicDownloader.py

On Windows: py musicDownloader.py

If there are any troubles with Selenium's required drivers, take a look at the excellent Selenium Documentation.

Usage

When the program is run, a GUI will prompt for either a Spotify playlist link, or a list of songs separated by commas. If a spotify link is pasted into the textbox, the program will scrape all the songs off that playlist. The program will then download all those songs and add them to a new folder in the ~/Music/ directory named after the playlist. Any songs entered in the textbox separated by commas will additionally be downloaded.

Limitations

  • Selenium must be used instead of only using Beautifulsoup4
    • This is due to how Spotify loads content, with just using Beautifulsoup, the site appears empty because the JavaScript has not loaded the page content
    • This means that there is a tedious process of dowloading the Selenium driver
  • Sometimes a video is not found in a file type supported by youtube-dl
  • No guarantee YouTube will have the song

License

Liscensed under the GNU General Public License v3.0

About

Scrape your Spotify playlist, search YouTube for the top lyrical video and download the audio to your Music folder!

Topics

Resources

License

Stars

Watchers

Forks

Languages