All Projects → vodka2 → Vk Audio Token

vodka2 / Vk Audio Token

Library that obtains VK tokens that work for VK audio API. Библиотека для получения токена VK, подходящего для Audio API.

Projects that are alternatives of or similar to Vk Audio Token

Datmusic Api
Alternative for VK Audio API
Stars: ✭ 160 (+97.53%)
Mutual labels:  audio, music, vk
Vk api
Модуль для создания скриптов для ВКонтакте | vk.com API wrapper
Stars: ✭ 1,070 (+1220.99%)
Mutual labels:  vk, vkontakte
Audio player flutter
🎧 Apple Music / Tidal Audio Player for Flutter
Stars: ✭ 52 (-35.8%)
Mutual labels:  audio, music
Sound Source Localization Algorithm doa estimation
关于语音信号声源定位DOA估计所用的一些传统算法
Stars: ✭ 58 (-28.4%)
Mutual labels:  audio, music
Pandoraplayer
🅿️ PandoraPlayer is a lightweight music player for iOS, based on AudioKit and completely written in Swift.
Stars: ✭ 1,037 (+1180.25%)
Mutual labels:  audio, music
Vyplayindicator
PlayIndicator inspired by Apple's Music Player.
Stars: ✭ 47 (-41.98%)
Mutual labels:  audio, music
Bpm
Library and tool for dealing with beats per second detection
Stars: ✭ 57 (-29.63%)
Mutual labels:  audio, music
Moodbar
Audio timeline visualization
Stars: ✭ 30 (-62.96%)
Mutual labels:  audio, music
Ctag Straempler
An open source eurorack sample streaming and sound synthesis module.
Stars: ✭ 65 (-19.75%)
Mutual labels:  audio, music
Fountain Of Colors
Music visualizer for Rainmeter
Stars: ✭ 65 (-19.75%)
Mutual labels:  audio, music
Audiokit
Swift audio synthesis, processing, & analysis platform for iOS, macOS and tvOS
Stars: ✭ 8,827 (+10797.53%)
Mutual labels:  audio, music
Nemiro.oauth.dll
Nemiro.OAuth is a class library for authorization via OAuth protocol in .NET Framework
Stars: ✭ 45 (-44.44%)
Mutual labels:  vk, vkontakte
Vk.py
Extremely-fast, easy-to-use, [not] ready for production. The asyncio based library for Python and Humans written to be efficient and reliable. [Unmaintained]
Stars: ✭ 38 (-53.09%)
Mutual labels:  vk, vkontakte
Sonic Pi
Code. Music. Live.
Stars: ✭ 8,736 (+10685.19%)
Mutual labels:  audio, music
Strawberry
🍓 Strawberry Music Player
Stars: ✭ 972 (+1100%)
Mutual labels:  audio, music
Musictheory
🎵 Music theory concepts in Go.
Stars: ✭ 53 (-34.57%)
Mutual labels:  audio, music
Deprecated Lame Mirror
[DEPRECATED] Old, Semi-official mirror of the CVS repository of the LAME MP3 encoder.
Stars: ✭ 73 (-9.88%)
Mutual labels:  audio, music
Cs.2click
🔊 A Better Audio Router for a Modular System.
Stars: ✭ 7 (-91.36%)
Mutual labels:  audio, music
Uc3moy
UC3Music-e version of the CMoy pocket headphone amplifier (originally designed by Chu Moy )
Stars: ✭ 13 (-83.95%)
Mutual labels:  audio, music
Vkrss
Generates RSS feed of opened/closed vk.com wall or global searched opened posts. Features: post filtering (include/exclude by regexp and/or by owner type), ads skipping, automatic title generation, hash-tags extraction as RSS categories, initial author extraction, HTML formatting
Stars: ✭ 59 (-27.16%)
Mutual labels:  vk, vkontakte

Library that obtains VK tokens that work for VK audio API

Read this in russian.

Python port of this library: vodka2/vkaudiotoken-python

This library obtains VK token, that works for VK audio API, so you can search artists, songs, albums, query audio URIs, add audios to "My audios" etc. The library supports Kate Mobile, Boom and VK Official clients. (Thanks to YTKABOBR for reversing the Boom client)

Actually there two versions of VK API, one for Kate Mobile and one for the official client. Boom client uses VK API somewhat similar to Kate one, but it has some limitations, not all methods are supported. Moreover it requires messages permission (do they scan our messages?) and sometimes returns 500 errors. On the other hand it supports another API in addition to VK API and may be used as a fallback.

Installation

composer require vodka2/vk-audio-token

... or simply copy the cloned repository somewhere and include src/autoloader.php. The library requires no dependencies.

Getting tokens

The simplest example:

<?php

use Vodka2\VKAudioToken\TokenFacade;

$login = "+71234567890";
$pass = "12345";

// print token and User-Agent
// setting User-Agent is mandatory when querying the API!
var_export(TokenFacade::getKateToken($login, $pass));

More advanced examples are in the examples directory. Start with example_simple.php.

Using tokens

The simplest example:

<?php

define('TOKEN', 'token from previous example');
define('USER_AGENT', 'User-Agent from previous example');
$ch = curl_init();

curl_setopt($ch, CURLOPT_HTTPHEADER, array('User-Agent: '.USER_AGENT));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt(
    $ch,
    CURLOPT_URL,
    "https://api.vk.com/method/audio.getById?access_token=".TOKEN.
    "&audios=".urlencode("371745461_456289486").
    "&v=5.95"
);

echo json_encode(json_decode(curl_exec($ch)), JSON_PRETTY_PRINT)."\n\n";

More examples that show how to use obtained VK tokens with different API methods are in the usage subdirectory. More detailed VK API description is available at https://vodka2.github.io/vk-audio-token/ (Currently in progress)

CLI tool

There is also more advanced CLI tool, that emulates Kate Mobile:

Usage: src/cli/vk-audio-token.php [options] vk_login vk_pass
       src/cli/vk-audio-token.php [options] non_refreshed_kate_token
Options:
-s file             - save GMS ID and token to the file
-l file             - load GMS ID and token from file
-g gms_id:gms_token - use specified GMS ID and token
-d file             - use droidguard string from file
                      instead of hardcoded one
-m                  - make microG checkin (default)
-o                  - old checkin with droidguard string
                      that may expire
                      with droidguard string is made
-t code             - use two factor authentication
                      pass GET_CODE to get code or
                      pass code received in SMS
-h                  - print this help

Docker

docker build -t vk-audio-tokens src/
docker run -t vk-audio-tokens:latest php src/cli/vk-audio-token.php -m vk_login vk_pass
docker run -t vk-audio-tokens:latest php src/examples/usage/example_kate.php token

2FA

Two factor authorization with SMS is supported for Kate and VK Official clients, however VK server sometimes does not send an SMS. If you don't receive it, you can use TwoFAHelper class to force resending. See example_twofahelper.php

For the Boom client the library uses implicit flow authorization and makes requests to the VK website. VK server may make a call, send an SMS or send private message to your VK account. You can also authenticate the client yourself and only pass the token and user id.

It is also possible to create separate passwords in VK account settings and use them instead of your account password.

GMS Credentials

GMS credentials are also obtained while obtaining tokens. There are two ways to obtain GMS credentials.

The first way is to get them from a rooted Android device. The token is in /data/data/com.google.android.gsf/shared_prefs/CheckinService.xml file and ID is in /data/data/com.google.android.gms/shared_prefs/Checkin.xml file. You can install GMS Credentials application to see them.

The second way is to perform Android Checkin yourself. Class AndroidCheckin is designed for this task. This class provides two options: checkin with droidguard string and checkin as in microG project. Note that the obtained credentials may expire.

For the first option you need a string that is generated by com.google.ccc.abuse.droidguard (the.apk). One such string is in example_droidguard_str.php file, it may expire. When using the second option one extra request is made and PHP needs to have sockets enabled.

It is also possible to intercept Android Checkin request (it is made on first boot) and see the returned GMS ID and token.

Buy me some healthy Russian drinks!

WMR — P778046516389

WMZ — Z828082159527

Yandex Money

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].