Audio fetcher
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import vk_api
|
import vk_api
|
||||||
|
|
||||||
# getting pazans
|
# getting pazans
|
||||||
@@ -11,7 +11,11 @@ with open(pazansFileName) as file:
|
|||||||
pazanIds = [int(line) for line in file]
|
pazanIds = [int(line) for line in file]
|
||||||
|
|
||||||
# getting music
|
# getting music
|
||||||
vk = vk_api.VkApi(token=sys.argv[3], app_id=sys.argv[4])
|
def captcha_handler(captcha):
|
||||||
|
key = input("Enter Captcha {0}: ".format(captcha.get_url())).strip()
|
||||||
|
return captcha.try_again(key)
|
||||||
|
|
||||||
|
vk = vk_api.VkApi(token=sys.argv[3], app_id=sys.argv[4], captcha_handler=captcha_handler)
|
||||||
|
|
||||||
for index, pazanId in enumerate(pazanIds, start=(int(sys.argv[5]) if len(sys.argv) > 5 else 0)):
|
for index, pazanId in enumerate(pazanIds, start=(int(sys.argv[5]) if len(sys.argv) > 5 else 0)):
|
||||||
done = False
|
done = False
|
||||||
@@ -19,7 +23,8 @@ for index, pazanId in enumerate(pazanIds, start=(int(sys.argv[5]) if len(sys.arg
|
|||||||
try:
|
try:
|
||||||
print(index)
|
print(index)
|
||||||
pazanSongs = []
|
pazanSongs = []
|
||||||
jsonData = vk.method("audio.get", {"owner_id": pazanId, "need_user": 0, "count": 100})
|
# jsonData = vk.method("audio.get", {"owner_id": pazanId, "need_user": 0, "count": 100})
|
||||||
|
jsonData = vk.method("execute.getMusic", {"id": pazanId})
|
||||||
for audio in jsonData["items"]:
|
for audio in jsonData["items"]:
|
||||||
pazanSong = {
|
pazanSong = {
|
||||||
"artist": audio["artist"],
|
"artist": audio["artist"],
|
||||||
|
|||||||
Reference in New Issue
Block a user