mirror of
https://gitlab.com/ytdl-org/youtube-dl.git
synced 2026-01-24 00:00:10 -05:00
Compare commits
7 Commits
2011.09.16
...
2011.09.18
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7b1a2bbe17 | ||
|
|
c25303c3d5 | ||
|
|
cc025e1226 | ||
|
|
eca1b76f01 | ||
|
|
366cbfb04a | ||
|
|
18bb3d1e35 | ||
|
|
10e7194db1 |
@@ -1 +1 @@
|
||||
2011.09.16
|
||||
2011.09.18
|
||||
|
||||
@@ -37,6 +37,8 @@ which means you can modify it, redistribute it or use it however you like.
|
||||
-a, --batch-file FILE file containing URLs to download ('-' for stdin)
|
||||
-w, --no-overwrites do not overwrite files
|
||||
-c, --continue resume partially downloaded files
|
||||
--no-continue do not resume partially downloaded files (restart
|
||||
from beginning)
|
||||
--cookies FILE file to dump cookie jar to
|
||||
--no-part do not use .part files
|
||||
--no-mtime do not use the Last-modified header to set the file
|
||||
|
||||
32
youtube-dl
32
youtube-dl
@@ -15,7 +15,7 @@ __author__ = (
|
||||
)
|
||||
|
||||
__license__ = 'Public Domain'
|
||||
__version__ = '2011.09.16'
|
||||
__version__ = '2011.09.18'
|
||||
|
||||
UPDATE_URL = 'https://raw.github.com/rg3/youtube-dl/master/youtube-dl'
|
||||
|
||||
@@ -775,8 +775,7 @@ class FileDownloader(object):
|
||||
|
||||
if not self.params.get('skip_download', False):
|
||||
try:
|
||||
success,add_data = self._do_download(filename, info_dict['url'].encode('utf-8'), info_dict.get('player_url', None))
|
||||
info_dict.update(add_data)
|
||||
success = self._do_download(filename, info_dict)
|
||||
except (OSError, IOError), err:
|
||||
raise UnavailableVideoError
|
||||
except (urllib2.URLError, httplib.HTTPException, socket.error), err:
|
||||
@@ -865,7 +864,10 @@ class FileDownloader(object):
|
||||
self.trouble(u'\nERROR: rtmpdump exited with code %d' % retval)
|
||||
return False
|
||||
|
||||
def _do_download(self, filename, url, player_url):
|
||||
def _do_download(self, filename, info_dict):
|
||||
url = info_dict['url']
|
||||
player_url = info_dict.get('player_url', None)
|
||||
|
||||
# Check file already present
|
||||
if self.params.get('continuedl', False) and os.path.isfile(filename) and not self.params.get('nopart', False):
|
||||
self.report_file_already_downloaded(filename)
|
||||
@@ -877,7 +879,6 @@ class FileDownloader(object):
|
||||
|
||||
tmpfilename = self.temp_name(filename)
|
||||
stream = None
|
||||
open_mode = 'wb'
|
||||
|
||||
# Do not include the Accept-Encoding header
|
||||
headers = {'Youtubedl-no-compression': 'True'}
|
||||
@@ -890,11 +891,14 @@ class FileDownloader(object):
|
||||
else:
|
||||
resume_len = 0
|
||||
|
||||
# Request parameters in case of being able to resume
|
||||
if self.params.get('continuedl', False) and resume_len != 0:
|
||||
self.report_resuming_byte(resume_len)
|
||||
request.add_header('Range', 'bytes=%d-' % resume_len)
|
||||
open_mode = 'ab'
|
||||
open_mode = 'wb'
|
||||
if resume_len != 0:
|
||||
if self.params.get('continuedl', False):
|
||||
self.report_resuming_byte(resume_len)
|
||||
request.add_header('Range','bytes=%d-' % resume_len)
|
||||
open_mode = 'ab'
|
||||
else:
|
||||
resume_len = 0
|
||||
|
||||
count = 0
|
||||
retries = self.params.get('retries', 0)
|
||||
@@ -996,11 +1000,10 @@ class FileDownloader(object):
|
||||
self.try_rename(tmpfilename, filename)
|
||||
|
||||
# Update file modification time
|
||||
filetime = None
|
||||
if self.params.get('updatetime', True):
|
||||
filetime = self.try_utime(filename, data.info().get('last-modified', None))
|
||||
info_dict['filetime'] = self.try_utime(filename, data.info().get('last-modified', None))
|
||||
|
||||
return True, {'filetime': filetime}
|
||||
return True
|
||||
|
||||
|
||||
class InfoExtractor(object):
|
||||
@@ -3567,6 +3570,9 @@ def parseOpts():
|
||||
action='store_true', dest='nooverwrites', help='do not overwrite files', default=False)
|
||||
filesystem.add_option('-c', '--continue',
|
||||
action='store_true', dest='continue_dl', help='resume partially downloaded files', default=False)
|
||||
filesystem.add_option('--no-continue',
|
||||
action='store_false', dest='continue_dl',
|
||||
help='do not resume partially downloaded files (restart from beginning)')
|
||||
filesystem.add_option('--cookies',
|
||||
dest='cookiefile', metavar='FILE', help='file to dump cookie jar to')
|
||||
filesystem.add_option('--no-part',
|
||||
|
||||
Reference in New Issue
Block a user