scdl
scdl copied to clipboard
fixing connection closed prematurely error for missing playlist tracks
Fixed the error that downloading process aborts due to missing records at playlists.
I think we need to test what is the response in the case of missing tracks and treat this case separately. The connection is usually closed prematurely when we loose internet connection or something like that. So it's useful to exit in this case and not try and fail to download the next tracks.
so it needs to be separated:
if received != total_length:
logger.error('connection closed prematurely, download incomplete, Skipping...')
from urllib.request import urlopen
# from urllib.request import urlopen
try:
urlopen('http://www.google.com', timeout=5)
# handling missing playlist tracks
return
except urllib.URLError as err:
# exiting due to internet connection error
logger.error('network error, exiting...')
sys.exit()
The "connection closed prematurely, download incomplete" error is thrown relatively frequently when downloading a long list of files. Could Soundcloud be terminating these longer download sessions? Perhaps when a certain download limit is reached? Or is my internet just cutting out?
Perhaps you just have a lot of striked songs in your playlist ?
This could also be a problem when it tries to download a song that a GO+ track, maybe add an exception flag for those kinds of tracks?