Friday, April 19, 2024
HomePythonSinging downloader with python

Singing downloader with python


Edit: This put up is about ex.fm which isn’t functioning anymore. ex.fm has closed their operations :crying_face:

Hello there of us. A while in the past i used to be very a lot thinking about how music downloaders for varied web sites labored. With the intention to study this i went ahead to make my very own downloader for ex.fm. At present ex.fm doesn’t permit customers to obtain songs so this was an excellent probability for me to study tune downloading with python.

Throughout this course of i additionally got here ahead to youtube-dl. It’s a python script which permits anybody to obtain music and movies from quite a few web sites. Now let me inform you how i went ahead to make this downloader.

To start with I opened ex.fm in chrome and likewise began chrome net inspector to intercept community calls. Then i clicked on a tune for it to play. When the tune began to play i noticed the XHR requests made by ex.fm. There i noticed a request being made to ex.fm/api.

This was attention-grabbing as a result of most web sites use apis to offer information for particular songs. I opened the hyperlink and noticed that the hyperlink returned json knowledge with direct hyperlink to the tune. That means i got here to know the url utilized by ex.fm to get the direct hyperlink to the tune.

After that I wished to know learn how to automate tune looking out from python. For this i once more opened ex.fm and chrome net inspector. This time as an alternative of taking part in a tune i clicked on search and looked for a tune. Once more a url obtained my consideration.

http://ex.fm/api/v3/tune/search/{search time period}?begin=0&outcomes=20

This url additionally returned json response. After i grew to become conscious of those two urls i began to put in writing a python script to automate this. I used solely three libraries and all three of them come preinstalled with python (batteries included). These three libraries have been:

urllib2 
json
sys

I gained’t be explaining the code right here as an alternative i offers you the code itself. When you’ve got any questions in regards to the code be at liberty to remark beneath. Lastly let me make it clear that this script may be written in higher methods however i simply made it for studying functions.

Right here is the hyperlink to the github repository.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments