Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

vk.com audio url decoder and parser

License

Notifications You must be signed in to change notification settings

yuru-yuri/vk-audio-url-decoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VK audio url decoder Build Status

PyPI - License GitHub issues PyPI

Maintainability Test Coverage

Usage:

pip install vaud

Decode urls:

import vaud

uid = 1
url = 'https://m.vk.com/mp3/audio_api_unavailable.mp3?extra=zuHdAgfLvxaXtd1W...CsDasdvv32yLjpy3yVBxrm#AqVYStC'
decoded_url = vaud.decode(uid, url)  # One track
import vaud

uid = 1
urls = [
    'https://m.vk.com/mp3/audio_api_unavailable.mp3?extra=zuHdAgfLvxaXtd1W...CsDasdvv32yLjpy3yVBxrm#AqVYStC',
    'https://m.vk.com/mp3/audio_api_unavailable.mp3?extra=zuHdAgfLvxaXtd1W...CsDasdvv32yLjpy3yVBxrm#AqVYStC',
    'https://m.vk.com/mp3/audio_api_unavailable.mp3?extra=zuHdAgfLvxaXtd1W...CsDasdvv32yLjpy3yVBxrm#AqVYStC',
]
decoder = vaud.Decoder(uid)  # Multiple tracks
decoded_urls = []
for url in urls:
    decoded_urls.append(decoder.decode(url))

Get all audio (not auto-decode):

import vaud

my_vk = MyVkClass()  # Own class for vk.com
cookies = my_vk.cookies # Get site cookies. dict()
uid = my_vk.uid  # User id

audio_parser = vaud.AlAudio(uid, cookies)  # Your or another user UID
urls = audio_parser.main()  [{'url': 'Encoded url', 'track': 'Track title', 'author': 'Author', 'id': 'VK Track id'}, ...]
urls = audio_parser.main(True)  [('Encoded url', 'Track title', 'Author', 'VK Track id'), ...]

decoded_urls = []  # Look before examples