Python library for VK Audio (API)


Keywords
vk, api, music, downloader, python, github-pages, hacktoberfest, learn, playlist, token
License
MIT
Install
pip install vkpymusic==3.0.1

Documentation

ЛицСнзия Π‘ΠΎΠ²ΠΌΠ΅ΡΡ‚ΠΈΠΌΠΎΡΡ‚ΡŒ с Python ВСрсия Π±ΠΈΠ±Π»ΠΈΠΎΡ‚Π΅ΠΊΠΈ

VKpyMusic

is a Python library that provides a simple interface for interacting with the VKontakte (VK) music service API. The library allows developers to easily perform operations related to music and other functionalities available through the VK API.

это Π±ΠΈΠ±Π»ΠΈΠΎΡ‚Π΅ΠΊΠ° Python, которая прСдоставляСт простой интСрфСйс для взаимодСйствия с API ΠΌΡƒΠ·Ρ‹ΠΊΠ°Π»ΡŒΠ½ΠΎΠ³ΠΎ сСрвиса Π’ΠšΠΎΠ½Ρ‚Π°ΠΊΡ‚Π΅ (VK). Π‘ΠΈΠ±Π»ΠΈΠΎΡ‚Π΅ΠΊΠ° позволяСт Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚Ρ‡ΠΈΠΊΠ°ΠΌ Π»Π΅Π³ΠΊΠΎ Π²Ρ‹ΠΏΠΎΠ»Π½ΡΡ‚ΡŒ ΠΎΠΏΠ΅Ρ€Π°Ρ†ΠΈΠΈ, связанныС с ΠΌΡƒΠ·Ρ‹ΠΊΠΎΠΉ ΠΈ Π΄Ρ€ΡƒΠ³ΠΈΠΌΠΈ Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΎΠ½Π°Π»ΡŒΠ½Ρ‹ΠΌΠΈ возмоТностями, доступными Ρ‡Π΅Ρ€Π΅Π· VK API.

Installation

You can install VKpyMusic using the pip package manager. Open your command prompt or terminal and execute the following command:

Π’Ρ‹ ΠΌΠΎΠΆΠ΅Ρ‚Π΅ ΡƒΡΡ‚Π°Π½ΠΎΠ²ΠΈΡ‚ΡŒ VKpyMusic с ΠΏΠΎΠΌΠΎΡ‰ΡŒΡŽ ΠΌΠ΅Π½Π΅Π΄ΠΆΠ΅Ρ€Π° ΠΏΠ°ΠΊΠ΅Ρ‚ΠΎΠ² pip. ΠžΡ‚ΠΊΡ€ΠΎΠΉΡ‚Π΅ ΠΊΠΎΠΌΠ°Π½Π΄Π½ΡƒΡŽ строку ΠΈΠ»ΠΈ Ρ‚Π΅Ρ€ΠΌΠΈΠ½Π°Π» ΠΈ Π²Ρ‹ΠΏΠΎΠ»Π½ΠΈΡ‚Π΅ ΡΠ»Π΅Π΄ΡƒΡŽΡ‰ΡƒΡŽ ΠΊΠΎΠΌΠ°Π½Π΄Ρƒ:

Console:

pip install vkpymusic

Usage

To get started with VKpyMusic, you will need a valid VK access token and user agent, which provides access to the VK music service API. But if you don't have them, it's okay - we have our own class to get it.

Π§Ρ‚ΠΎΠ±Ρ‹ Π½Π°Ρ‡Π°Ρ‚ΡŒ Ρ€Π°Π±ΠΎΡ‚Ρƒ с VKpyMusic, Π²Π°ΠΌ понадобится Π΄Π΅ΠΉΡΡ‚Π²ΠΈΡ‚Π΅Π»ΡŒΠ½Ρ‹ΠΉ Ρ‚ΠΎΠΊΠ΅Π½ доступа ΠΊ VK ΠΈ ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»ΡŒΡΠΊΠΈΠΉ Π°Π³Π΅Π½Ρ‚, ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΉ прСдоставляСт доступ ΠΊ API ΠΌΡƒΠ·Ρ‹ΠΊΠ°Π»ΡŒΠ½ΠΎΠ³ΠΎ сСрвиса VK. Но Ссли Ρƒ вас ΠΈΡ… Π½Π΅Ρ‚, Π½ΠΈΡ‡Π΅Π³ΠΎ ΡΡ‚Ρ€Π°ΡˆΠ½ΠΎΠ³ΠΎ - Ρƒ нас Π΅ΡΡ‚ΡŒ свой собствСнный класс, Ρ‡Ρ‚ΠΎΠ±Ρ‹ ΠΏΠΎΠ»ΡƒΡ‡ΠΈΡ‚ΡŒ ΠΈΡ….

Example usage of VKpyMusic for receive token and user agent:
ΠŸΡ€ΠΈΠΌΠ΅Ρ€ использования VKpyMusic для получСния Ρ‚ΠΎΠΊΠ΅Π½Π° ΠΈ ΡŽΠ·Π΅Ρ€-Π°Π³Π΅Π½Ρ‚Π°:

Python:

from vkpymusic import TokenReceiver

login = input("   Enter login: ")
password = input("Enter password: ")

tokenReceiver = TokenReceiver(login, password)

if tokenReceiver.auth():
    tokenReceiver.get_token()
    tokenReceiver.save_to_config()

Result:

   Enter login: +...........
Enter password: .........
SMS with a confirmation code has been sent to your phone! The code is valid for a few minutes!
Code: 277765
Token was received!
Token was saved!

Create an Service instance with your access token and user agent:
Π‘ΠΎΠ·Π΄Π°ΠΉΡ‚Π΅ экзСмпляр Service с вашим Ρ‚ΠΎΠΊΠ΅Π½ΠΎΠΌ ΠΈ ΡŽΠ·Π΅Ρ€-Π°Π³Π΅Π½Ρ‚ΠΎΠΌ:

Python:

from vkpymusic import Service

service = Service.parse_config()

Or you can do like this:
Или Π’Ρ‹ ΠΌΠΎΠΆΠ΅Ρ‚Π΅ ΡΠ΄Π΅Π»Π°Ρ‚ΡŒ Ρ‚Π°ΠΊ:

Python:

service = Service("<your_token>", "<your_client>")

Get information about the current user
ΠŸΠΎΠ»ΡƒΡ‡ΠΈΡ‚ΡŒ ΠΈΠ½Ρ„ΠΎΡ€ΠΌΠ°Ρ†ΠΈΡŽ ΠΎ пСснях Ρ‚Π΅ΠΊΡƒΡ‰Π΅Π³ΠΎ ΠΏΠΎΠ»ΡŒΠ·ΠΎΠ²Π°Ρ‚Π΅Π»Ρ

Python:

user_songs = service.get_songs_by_userid(5, 10)

Search for tracks by query
Поиск Ρ‚Ρ€Π΅ΠΊΠΎΠ² ΠΏΠΎ запросу

Python:

songs = service.search_songs_by_text("Maroon V", 5)

Full example
ΠŸΠΎΠ»Π½Ρ‹ΠΉ ΠΏΡ€ΠΈΠΌΠ΅Ρ€

Python:

from vkpymusic import Service, TokenReceiver
login = input("   Enter login: ")
password = input("Enter password: ")

tokenReceiver = TokenReceiver(login, password)

if tokenReceiver.auth():
    tokenReceiver.get_token()
    tokenReceiver.save_to_config()

service = Service.parse_config()
tracks = service.search_songs_by_text('idfc tiktok remix')
Service.save_music(tracks[0])

Documentation
ДокумСнтация

Detailed documentation and usage examples for VKpyMusic can be found on the official project page on GitHub:

Π”Π΅Ρ‚Π°Π»ΡŒΠ½Π°Ρ докумСнтация ΠΈ ΠΏΡ€ΠΈΠΌΠ΅Ρ€Ρ‹ использования для VKpyMusic находится Π½Π° ΠΎΡ„ΠΈΡ†ΠΈΠ°Π»ΡŒΠ½ΠΎΠΉ страницС Π½Π° Π“ΠΈΡ‚Π₯Π°Π±Π΅:

Contributions and Support

Если Ρƒ вас Π΅ΡΡ‚ΡŒ ΠΊΠ°ΠΊΠΈΠ΅-Π»ΠΈΠ±ΠΎ прСдлоТСния ΠΏΠΎ ΡƒΠ»ΡƒΡ‡ΡˆΠ΅Π½ΠΈΡŽ VKpyMusic ΠΈΠ»ΠΈ Π²Ρ‹ ΠΎΠ±Π½Π°Ρ€ΡƒΠΆΠΈΡ‚Π΅ ΠΊΠ°ΠΊΠΈΠ΅-Π»ΠΈΠ±ΠΎ ΠΏΡ€ΠΎΠ±Π»Π΅ΠΌΡ‹, поТалуйста, создайтС Π½ΠΎΠ²ΡƒΡŽ ΠΏΡ€ΠΎΠ±Π»Π΅ΠΌΡƒ Π½Π° страницС ΠΏΡ€ΠΎΠ΅ΠΊΡ‚Π° GitHub. ΠœΡ‹ привСтствуСм ваши запросы Π½Π° исправлСния ΠΈ Π³ΠΎΡ‚ΠΎΠ²Ρ‹ ΠΏΠΎΠΌΠΎΡ‡ΡŒ Π²Π°ΠΌ с Π»ΡŽΠ±Ρ‹ΠΌΠΈ ΠΏΡ€ΠΎΠ±Π»Π΅ΠΌΠ°ΠΌΠΈ, с ΠΊΠΎΡ‚ΠΎΡ€Ρ‹ΠΌΠΈ Π²Ρ‹ ΡΡ‚ΠΎΠ»ΠΊΠ½Π΅Ρ‚Π΅ΡΡŒ.

If you have any suggestions for improving VKpyMusic or if you find any issues, please create a new issue on the GitHub project page. We welcome your pull requests and are here to assist you with any problems you encounter.

License

VKpyMusic is distributed under the MIT license. For detailed information about the license, see the LICENSE file.

Authors

VKpyMusic is developed by the @issamansur or/and 'EDEXADE, inc.' development team.