Attention! The article does not pretend to be a scientific candidate. Published solely in order to help those who do not want to write the code itself. If you do not listen to music VKontakte, do not use social. networks and you are allergic to
my govnokod code written by a student, you will not be interested.
About a year ago I wrote a script for downloading music from vk, and in normal quality (at least> 250 kbps). It will be useful for those who want to download their playlist on VKontakte or just for convenient downloading of music
before it's too late . By “convenient download,” at that time, I meant downloading songs that are soundtracks to a TV series or movie, downloading by artist, and downloading by title. For example, enter "OST Pulp Fiction" and get a folder with songs from the movie Pulp Fiction.
How the script appearedI am a music lover and try to keep all the music on my home computer. But once I was cut off from my home media library. Searches for ways to quickly pump out all the music that I usually listen to, as well as download new ones, led me to write a script. There was no talk of any online services, because I wanted to listen to music both offline and on a smartphone. The script was written solely for myself, in the light of recent events I decided to share.
How to use the scriptThe script requires Python 2.7.
The archive with the script can be downloaded
here . Unpack, open the file vkMusicDwn.py and adjust the parameters at the very beginning of the file.
dpath The folder where the music will be downloaded.
email your login
password your password
bitrate Minimum bitrate
If you do not want to enter your login and password each time, you can uncomment the block "### This block for static email and password", and enter your login and password.
Do not forget to comment out the block "### This block uncommented if you want to put email and". Authorization is taken
from here.Run the script.
user@user:$ python vkMusicDwn.py.
How the script worksFiltering songs.
- The song should weigh no more than 23 megabytes and the bitrate should be above 230. If not, the song is on the list of bad songs.
- All unnecessary words and symbols are removed from the file name. The script downloads the songs, and saves them as “Artist - Title.mp3”
- For all songs from the bad list, the search operation is repeated.
')
The script has 2 main modes of operation.
- Download user playlist
- Downloading songs by the entered string
In the first case, everything is clear. After starting and entering the login \ password the question will be asked:
Download users playlist? ( yes/no ):
Answer 'yes' and the script will try to download all the music from your playlist.
In the second case, you answer 'no' and enter what you want to find, how many songs to download, and what offset to do relative to the search output of vkontakte. For example, I wanted to learn the Metallica group.
What do want to find: Metallica How many songs do want to download: 10 Put offset: 0
Download songs of Metallica, 10 pieces, offset 0. Later, if you like the group, enter the same parameters, but set the offset 10. As a result, the script downloads the next 10 songs from the search results.
Later I tried to fasten some interface, but unfortunately there is not enough time. As they say there is nothing more permanent than temporary.
Link on github.com.
I will be glad to any constructive criticism, especially regarding the code.
Update Thank you
scorched for error messages. Fixed a problem with uploading your playlist.