mirror of
https://gitlab.com/RemixDev/deemix-py.git
synced 2024-12-28 02:26:14 +00:00
Use HEAD not GET to test track url, and send User-Agent
Means we can avoid stream=True and the issues around returning the connection to the pool detailed here: https://requests.readthedocs.io/en/latest/user/advanced/#body-content-workflow
This commit is contained in:
parent
bb98953963
commit
1969d3ca7e
|
@ -616,7 +616,7 @@ class DownloadJob:
|
|||
if int(track.filesizes[f"FILESIZE_{format}"]) != 0:
|
||||
return format_num
|
||||
elif not track.filesizes[f"FILESIZE_{format}_TESTED"]:
|
||||
request = get(self.dz.get_track_stream_url(track.id, track.MD5, track.mediaVersion, format_num), stream=True)
|
||||
request = requests.head(self.dz.get_track_stream_url(track.id, track.MD5, track.mediaVersion, format_num), headers={'User-Agent': USER_AGENT_HEADER}, timeout=30)
|
||||
try:
|
||||
request.raise_for_status()
|
||||
return format_num
|
||||
|
|
Loading…
Reference in a new issue