Fix m3u8 encoding error for soundcloud

This commit is contained in:
Nathan Thomas 2022-02-05 22:33:00 -08:00
parent 7b3aab1823
commit 5c8e0b1530
2 changed files with 4 additions and 4 deletions

View file

@ -186,9 +186,7 @@ class DownloadPool:
async with session.get(url) as response, aiofiles.open(filename, "wb") as f: async with session.get(url) as response, aiofiles.open(filename, "wb") as f:
# without aiofiles 3.6632679780000004s # without aiofiles 3.6632679780000004s
# with aiofiles 2.504482839s # with aiofiles 2.504482839s
content = await response.content.read() await f.write(await response.content.read())
print(content)
await f.write(content)
if self.callback: if self.callback:
self.callback() self.callback()

View file

@ -439,7 +439,9 @@ class Track(Media):
import m3u8 import m3u8
import requests import requests
parsed_m3u = m3u8.loads(requests.get(dl_info["url"]).text) parsed_m3u = m3u8.loads(
requests.get(dl_info["url"]).content.decode("utf-8")
)
self.path += ".mp3" self.path += ".mp3"
with DownloadPool(segment.uri for segment in parsed_m3u.segments) as pool: with DownloadPool(segment.uri for segment in parsed_m3u.segments) as pool: