Script for downloading music from vkontakte

A quick search of corresponding python script doesn’t give results. In post on habra link is broken. So i decided to write my own bicycle, it is avaliable here.

Launch (needs installed python interpreter):

python vkcom_audio_download.py

Tested on python 2.6 and 2.7. No external libraries required.

Algorithm

Script checks saved access_token. If it doesn’t exists or expired, then page with authorisation is opened in browser. After confirmation you will be redirected to https://oauth.vk.com/blank.htm#… It is needed to copy this url and paste to script console. After that downloading is started. If audio track is present on disk - no downloading happens for it.

You account info will be requested by application with app_id = 3358129. It is possible to create your own Standalone-application with audio access at http://vk.com/editapp?act=create. And replace APP_ID with yours.

Script avaliable here: https://gist.github.com/4708673.

Script code: