Skip to main content

Лицензия Совместимость с Python Версия библиотеки PyPi downloads

VKpyMusic

Click here to switch to English version

VKpyMusic - это библиотека Python, которая предоставляет простой интерфейс для взаимодействия с API музыкального сервиса ВКонтакте (VK). Библиотека позволяет разработчикам легко выполнять операции, связанные с музыкой и другими функциональными возможностями, доступными через VK API.

Установка

Библиотека протестирована с Python 3.13.

  • Установка через pip (менеджер пакетов Python):

     $ pip install vkpymusic
    
  • Установка из исходников (требуется git):

     $ pip install git+https://github.com/issamansur/vkpymusic.git
    

Рекомендуется использование первого варианта.

Использование

Чтобы начать работу с VKpyMusic, вам понадобится действительный токен доступа к VK и пользовательский агент, который предоставляет доступ к API музыкального сервиса VK. Но если у вас их нет, ничего страшного - у нас есть свой собственный класс для их получения.


Использование класса TokenReceiver для получения токена и юзер-агента

Для получения токена VKpyMusic задействует класс TokenReceiver, который отвечает за выполнение авторизации с использованием доступных логина и пароля. Он предоставляет методы для обработки captcha, двухфакторной аутентификации и различных сценариев ошибок. Подробнее о работе класса здесь.

from vkpymusic import TokenReceiver

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

tokenReceiver = TokenReceiver(login, password)

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

Результат:

   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!


Использование класса Service

  • Для начала работы с аудио вы можете воспользоваться токеном, сгенерированным в прошлом пункте с помощью класса TokenReceiver:

     from vkpymusic import Service
     
     service = Service.parse_config()
    
  • Или указать свой токен и юзер-агент:

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

Подробнее о работе класса здесь

Получить информацию о песнях текущего пользователя

Следующий код пытается получить 10 треков пользователя. Обратите внимание, что в качестве первого аргумента принимается только ID пользователя (не username)! Если аудиозаписи пользователя закрыты, вызывается исключение VkApiException: VK API Error 201: Access denied.

user_songs = service.get_songs_by_userid(123456789, 10)

Поиск треков по запросу

songs = service.search_songs_by_text("Radiohead no surprises", 5)

Получить популярные треки

songs = service.get_popular(count=50, offset=0)

Сохранить трек локально

songs = service.search_songs_by_text("Radiohead no surprises", 5)
Service.save_music(songs[0])
# или
service.save_music(songs[0])


Полный пример

from vkpymusic import Service, TokenReceiver

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

tokenReceiver = TokenReceiver(login, password)

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

service = Service.parse_config()
tracks = service.search_songs_by_text('Radiohead no surprises')
Service.save_music(tracks[0])

Документация

Детальная документация и примеры использования для VKpyMusic находится на официальной странице GitHub:

https://github.com/issamansur/vkpymusic

https://issamansur.github.io/vkpymusic/

Вклад и поддержка

Если у вас есть какие-либо предложения по улучшению VKpyMusic или вы обнаружите какие-либо проблемы, пожалуйста, создайте новую проблему на странице проекта GitHub. Мы приветствуем ваши запросы на исправления и готовы помочь вам с любыми проблемами, с которыми вы столкнетесь.

Лицензия

VKpyMusic распространяется под лицензией MIT. За более детальной информацией о лицензии обратитесь к файлу LICENSE.

Авторы

VKpyMusic разрабатывается @issamansur или/и командой 'EDEXADE, inc.'

Release files for vkpymusic 4.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vkpymusic 4.0.2
File Size Uploaded
vkpymusic-4.0.2.tar.gz 24.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vkpymusic 4.0.2
File Interpreter ABI Platform
vkpymusic-4.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 54.3 kB

Release files / vkpymusic-4.0.2.tar.gz

Download URL vkpymusic-4.0.2.tar.gz
Size 24.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8c9abe45dd515b5124d9afac29fd6686921ca9b41a1bd453c82543c0de9f76fa
BLAKE2b-256 checksum
How to use checksums
d226ce085980b56d193805590a44cb065e440d96014c367d33aca655b36a97a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 19, 2026.

Transparency log

Release files / vkpymusic-4.0.2-py3-none-any.whl

Download URL vkpymusic-4.0.2-py3-none-any.whl
Size 29.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
70a62156b5dac6c67f5e5af13297597564f446a565b5eaf0a0677ae84e2c5872
BLAKE2b-256 checksum
How to use checksums
29f91c5221a77c5d03423f909076de7c43ef045ffb4f60728670923c6800bd2c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 19, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

4.0.2 This release

2 release files

4.0.1

2 release files

4.0.0

2 release files

3.5.1

2 release files

3.5.0

2 release files

3.4.3

2 release files

3.4.1

2 release files

3.4.0

2 release files

3.3.3

2 release files

3.3.1

2 release files

3.3.0

2 release files

3.2.2

2 release files

3.2.1

2 release files

3.2.0

2 release files

3.1.0

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.2.4

2 release files

2.2.3

2 release files

2.2.2

2 release files

2.2.0

2 release files

2.1.2

2 release files

2.1.1

2 release files

2.1.0

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page