Last active
May 1, 2026 08:38
-
-
Save mrtnvgr/5efcc678fc58e66e2746c2e79708d49b to your computer and use it in GitHub Desktop.
[VK Music] Delete all tracks from artists
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ | |
| Install dependencies: | |
| pip install git+https://github.com/voronind/vk beautifulsoup4 | |
| Working as of May 1, 2026 | |
| """ | |
| from collections import defaultdict | |
| from vk import API | |
| import os | |
| def clear(): | |
| return os.system("cls" if os.name == "nt" else "clear") | |
| # use vkhost.github.io | |
| # set app id to 6287487 | |
| # request audio permissions | |
| access_token = "PUT THE TOKEN THERE" | |
| print("Logging in...") | |
| api = API(access_token=access_token, v="5.81") | |
| print("Getting ALL audio, please wait...") | |
| total_count = api.audio.get()["count"] | |
| tracks = [] | |
| for offset in range(0, total_count, 200): | |
| resp = api.audio.get(offset=offset) | |
| tracks.extend(resp["items"]) | |
| artists = defaultdict(list) | |
| for track in tracks: | |
| artists[track["artist"]].append(track) | |
| for artist, tracks in artists.items(): | |
| clear() | |
| print(f"Do you want to delete all tracks from \"{artist}\"?") | |
| print() | |
| print("These tracks:") | |
| for track in tracks: | |
| title = track["title"] | |
| print(f"- {title}") | |
| print() | |
| answer = input("Yes / No? [y/n]: ") | |
| if answer != "y": continue | |
| for track in tracks: | |
| api.audio.delete(owner_id=track["owner_id"], audio_id=track["id"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment