mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-11-27 14:15:37 +01:00
Consider the file downloaded if the size differs in less than 100 bytes (fixes issue #175)
This commit is contained in:
parent
101e0d1e91
commit
268fb2bdd8
11
youtube-dl
11
youtube-dl
|
@ -542,8 +542,15 @@ class FileDownloader(object):
|
||||||
raise
|
raise
|
||||||
else:
|
else:
|
||||||
# Examine the reported length
|
# Examine the reported length
|
||||||
if content_length is not None and long(content_length) == resume_len:
|
if (content_length is not None and
|
||||||
# The file had already been fully downloaded
|
resume_len - 100 < long(content_length) < resume_len + 100):
|
||||||
|
# The file had already been fully downloaded.
|
||||||
|
# Explanation to the above condition: in issue #175 it was revealed that
|
||||||
|
# YouTube sometimes adds or removes a few bytes from the end of the file,
|
||||||
|
# changing the file size slightly and causing problems for some users. So
|
||||||
|
# I decided to implement a suggested change and consider the file
|
||||||
|
# completely downloaded if the file size differs less than 100 bytes from
|
||||||
|
# the one in the hard drive.
|
||||||
self.report_file_already_downloaded(filename)
|
self.report_file_already_downloaded(filename)
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user