self.to_stdout(u'[download] Download completed')
else:
self.to_stdout(u'')
+
+ def increment_downloads(self):
+ """Increment the ordinal that assigns a number to each file."""
+ self._num_downloads += 1
def process_info(self, info_dict):
"""Process a single dictionary returned by an InfoExtractor."""
try:
(stream, filename) = sanitize_open(filename, open_mode)
self.report_destination(filename)
- self._num_downloads += 1
except (OSError, IOError), err:
self.trouble('ERROR: unable to open for writing: %s' % str(err))
return False
if mobj is None:
self._downloader.trouble(u'ERROR: invalid URL: %s' % url)
return
+
+ # At this point we have a new video
+ if self._downloader is not None:
+ self._downloader.increment_downloads()
video_id = mobj.group(2)
# Downloader parameters
self._youtube_ie.extract('http://www.youtube.com/watch?v=%s' % mobj2.group(1))
return
+ # At this point we have a new video
+ if self._downloader is not None:
+ self._downloader.increment_downloads()
+
simple_title = mobj.group(2).decode('utf-8')
video_extension = 'flv'
self._downloader.trouble(u'ERROR: invalid URL: %s' % url)
return
+ # At this point we have a new video
+ if self._downloader is not None:
+ self._downloader.increment_downloads()
video_id = mobj.group(1)
simple_title = mobj.group(2).decode('utf-8')
self._downloader.trouble(u'ERROR: Invalid URL: %s' % url)
return
+ # At this point we have a new video
+ if self._downloader is not None:
+ self._downloader.increment_downloads()
video_id = mobj.group(1)
video_extension = 'mp4'
self._downloader.trouble(u'ERROR: Invalid URL: %s' % url)
return
+ # At this point we have a new video
+ if self._downloader is not None:
+ self._downloader.increment_downloads()
video_id = mobj.group(1)
video_extension = 'flv'
def _real_initialize(self):
return
- def _real_extract(self, url):
+ def _real_extract(self, url, new_video=True):
# Extract ID from URL
mobj = re.match(self._VALID_URL, url)
if mobj is None:
self._downloader.trouble(u'ERROR: Invalid URL: %s' % url)
return
+ # At this point we have a new video
+ if self._downloader is not None and new_video:
+ self._downloader.increment_downloads()
video_id = mobj.group(2)
video_extension = 'flv'
yahoo_vid = mobj.group(1)
url = 'http://video.yahoo.com/watch/%s/%s' % (yahoo_vid, yahoo_id)
- return self._real_extract(url)
+ return self._real_extract(url, new_video=False)
# Retrieve video webpage to extract further information
request = urllib2.Request(url)
return
def _real_extract(self, url):
+ # At this point we have a new video
+ if self._downloader is not None:
+ self._downloader.increment_downloads()
+
video_id = url.split('/')[-1]
request = urllib2.Request(url)
try: