@@ 168,14 168,15 @@ for i,item in enumerate(items):
doc = bs4.BeautifulSoup(requests.get(url).text, 'html.parser')
pagedata = json.loads(doc.find(id='pagedata')['data-blob'])
for n,dlitem in enumerate(pagedata['download_items']):
- if dlitem['download_type'] == 'a':
+ dltype = dlitem['download_type_str'].lower()
+ if dltype == 'album':
filename = clean_filename(f'{dlitem["artist"]} - {dlitem["title"]}')+'.zip'
for codec in ['flac','alac','aiff-lossless','wav','mp3-320']:
if codec not in dlitem['downloads']:
continue
download = dlitem['downloads'][codec]['url']
break
- elif dlitem['download_type'] == 't':
+ elif dltype == 'track':
filename = clean_filename(f'{dlitem["artist"]} - {dlitem["title"]}')+'.'
for codec in ['flac','alac','aiff-lossless','wav','mp3-320']:
if codec not in dlitem['downloads']:
@@ 184,7 185,8 @@ for i,item in enumerate(items):
filename += codec.split('-')[0]
break
else:
- print(f'Skipping {dlitem["artist"]} - {dlitem["title"]}: unknown type {item["download_type"]}')
+ print(f'Skipping {dlitem["artist"]} - {dlitem["title"]}: unknown type {dltype}')
+ print(f'You might want to report this to ~aleteoryx!')
skipped += 1
continue
filepath = p.joinpath(filename)