demos
This commit is contained in:
parent
fca7ad9ccc
commit
9326ff73ca
1 changed files with 58 additions and 0 deletions
58
scrape.py
58
scrape.py
|
@ -108,3 +108,61 @@ for song in response.json()['items']:
|
||||||
with requests.get(performance['bootleg'], stream=True) as stream:
|
with requests.get(performance['bootleg'], stream=True) as stream:
|
||||||
with open(filename, 'wb') as file:
|
with open(filename, 'wb') as file:
|
||||||
copyfileobj(stream.raw, file)
|
copyfileobj(stream.raw, file)
|
||||||
|
|
||||||
|
# demos
|
||||||
|
response = session.post(
|
||||||
|
'https://www.spektorsthesaurus.com/_api/cloud-data/v1/wix-data/collections/query',
|
||||||
|
headers={
|
||||||
|
'Accept': 'application/json',
|
||||||
|
},
|
||||||
|
cookies={
|
||||||
|
'svSession': session_id,
|
||||||
|
},
|
||||||
|
json={
|
||||||
|
'collectionName':'tblSongDemo',
|
||||||
|
'dataQuery':{
|
||||||
|
'filter':{
|
||||||
|
'$and':[
|
||||||
|
{
|
||||||
|
'song_id': {
|
||||||
|
'$eq': song_id,
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
},
|
||||||
|
'sort':[
|
||||||
|
{
|
||||||
|
'fieldName':'song_name',
|
||||||
|
'order':'ASC'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'paging':{
|
||||||
|
'offset':0,
|
||||||
|
'limit':999
|
||||||
|
},
|
||||||
|
'fields':[]
|
||||||
|
},
|
||||||
|
'options':{},
|
||||||
|
'includeReferencedItems':[],
|
||||||
|
'segment':'LIVE',
|
||||||
|
'appId':'e3c84d19-bfb6-4299-824a-3236a027d528'
|
||||||
|
},
|
||||||
|
)
|
||||||
|
response.raise_for_status()
|
||||||
|
|
||||||
|
for demo in response.json()['items']:
|
||||||
|
if 'link' in demo:
|
||||||
|
_, extension = splitext(demo['link'])
|
||||||
|
filename = f"{song['song_name']} - {demo['release_name']}{extension}".replace('/', '|')
|
||||||
|
|
||||||
|
if exists(filename):
|
||||||
|
print(filename, 'exists')
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
print('downloading', filename)
|
||||||
|
|
||||||
|
with requests.get(demo['link'], stream=True) as stream:
|
||||||
|
with open(filename, 'wb') as file:
|
||||||
|
copyfileobj(stream.raw, file)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue