- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
import json
import time
import requests
from multiprocessing.dummy import Pool as ThreadPool
max_threads = 10
fname = "data.json"
headers = {"user-agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36", "referer":"https://datmusic.xyz/?q=Home+resonance", "authority":"api-2.datmusic.xyz"}
def api(url):
while True:
try:
r = requests.get(url, headers=headers)
r = r.json()
if r['status'] == 'error':
pass
else:
return r['data'][0]['download']
except Exception as e:
pass
def download(a):
# open in binary mode
while True:
try:
with open(a[1]+".mp3", "wb") as file:
response = requests.get(a[0],headers=headers)
if not (response.status_code == 503):
file.write(response.content)
print(a[1],"downloaded")
break
else:
pass
except Exception as e:
pass
songs = []
with open(fname) as json_data:
data = json.load(json_data)
for mp3 in data['list']:
song = []
autor = mp3[4]
title = mp3[3][:-5]
song.append(autor)
song.append(title)
songs.append(song)
links = []
def linker(a):
song = []
link = api("https://api-2.datmusic.xyz/search?q=" + a[0] + "+" + a[1] + "&page=0")
song.append(link)
song.append(a[0] + ' - ' + a[1])
links.append(song)
print(a[1])
for a in songs:
linker(a)
#if len(links) > 10:
# break
pool = ThreadPool(max_threads)
results = pool.map(download, links)
pool.close()
pool.join()
#Наговнокодил загрущик плейлистов с контача. Как получить json плейлиста подумай сам (перейди в музыку, открой Network в f12 и мониторь запрос при открытии плейлиста)
#Парсер 1 поточный, загрущик многопоточный. Работает через апи datmusic.xyz спс им
#vk.com music downloader v1.0a
#загрущик музыки вк
json = https://gist.githubusercontent.com/alekxeyuk/a1ccd2c62ab56a71320a02582cfc06f9/raw/4f2622c4beeddfa7e3082c276e1c138c87478e83/data.json
guest8 17.05.2018 21:38 # −999
pedikulez_v3 17.05.2018 22:13 # 0
semens 17.05.2018 23:42 # −1
shit_again 19.05.2018 15:55 # 0
Ты пассивный гей?