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-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VK audio url decoder Build Status

GitHub license GitHub issues Packagist Packagist PHP from Packagist

Maintainability Test Coverage

Usage:

composer require yuru-yuri/vaud

Decode urls

<?php
use YuruYuri\Vaud\Decoder;

$uid = 1;  // You vk uid
$url = 'https://m.vk.com/mp3/audio_api_unavailable.mp3?extra=CeHXAgfYufnZDhy3twvZEvfIuZy4Cu0...#ASS...'; 

$decoder = new Decoder($uid);
$decodedUrl = $decoder->decode($url);

$decodedUrl === 'https://cs1-23v1.vkuseraudio.net/p1/ae1240a98cf.mp3?extra=XZ...';

Get all audio (not auto-decode):

<?php
use YuruYuri\Vaud\AlAudio;

$my_vk = new MyVkClass();  # Own class for vk.com
$cookies = $my_vk->cookies; # Get site cookies. dict()
$uid = $my_vk->uid;  # User id

$audio_parser = new AlAudio($uid /* Your or another user */, $cookies);
$all_urls = $audio_parser->main();

// result:
[
  [
    'url' => 'Encoded url', 
    'track' => 'Track name', 
    'author' => 'Author', 
    'id' => 'VK track id',
    0 => 'Encoded url', 
    1 => 'Track name',
    2 => 'Author', 
    3 => 'VK track id'
  ],
  [
    'url' => 'Encoded url', 
    'track' => 'Track name', 
    'author' => 'Author', 
    'id' => 'VK track id',
    0 => 'Encoded url', 
    1 => 'Track name',
    2 => 'Author', 
    3 => 'VK track id'
  ],
];

$decoded_urls = [];  # Look before examples