Prechádzať zdrojové kódy

[bliptv] Remove support for direct downloads

This is now handled by the generic IE
Philipp Hagemeister 11 rokov pred
rodič
commit
1538eff6d8

+ 2 - 3
youtube_dl/YoutubeDL.py

@@ -542,7 +542,7 @@ class YoutubeDL(object):
             def make_result(embedded_info):
             def make_result(embedded_info):
                 new_result = ie_result.copy()
                 new_result = ie_result.copy()
                 for f in ('_type', 'url', 'ext', 'player_url', 'formats',
                 for f in ('_type', 'url', 'ext', 'player_url', 'formats',
-                          'entries', 'urlhandle', 'ie_key', 'duration',
+                          'entries', 'ie_key', 'duration',
                           'subtitles', 'annotations', 'format',
                           'subtitles', 'annotations', 'format',
                           'thumbnail', 'thumbnails'):
                           'thumbnail', 'thumbnails'):
                     if f in new_result:
                     if f in new_result:
@@ -856,8 +856,7 @@ class YoutubeDL(object):
             else:
             else:
                 self.to_screen(u'[info] Writing video description metadata as JSON to: ' + infofn)
                 self.to_screen(u'[info] Writing video description metadata as JSON to: ' + infofn)
                 try:
                 try:
-                    json_info_dict = dict((k, v) for k, v in info_dict.items() if not k in ['urlhandle'])
-                    write_json_file(json_info_dict, encodeFilename(infofn))
+                    write_json_file(info_dict, encodeFilename(infofn))
                 except (OSError, IOError):
                 except (OSError, IOError):
                     self.report_error(u'Cannot write metadata to JSON file ' + infofn)
                     self.report_error(u'Cannot write metadata to JSON file ' + infofn)
                     return
                     return

+ 0 - 2
youtube_dl/downloader/http.py

@@ -52,8 +52,6 @@ class HttpFD(FileDownloader):
         while count <= retries:
         while count <= retries:
             # Establish connection
             # Establish connection
             try:
             try:
-                if count == 0 and 'urlhandle' in info_dict:
-                    data = info_dict['urlhandle']
                 data = compat_urllib_request.urlopen(request)
                 data = compat_urllib_request.urlopen(request)
                 break
                 break
             except (compat_urllib_error.HTTPError, ) as err:
             except (compat_urllib_error.HTTPError, ) as err:

+ 1 - 18
youtube_dl/extractor/bliptv.py

@@ -21,7 +21,7 @@ from ..utils import (
 class BlipTVIE(InfoExtractor):
 class BlipTVIE(InfoExtractor):
     """Information extractor for blip.tv"""
     """Information extractor for blip.tv"""
 
 
-    _VALID_URL = r'^(?:https?://)?(?:\w+\.)?blip\.tv/((.+/)|(play/)|(api\.swf#))(.+)$'
+    _VALID_URL = r'^(?:https?://)?(?:www\.)?blip\.tv/((.+/)|(play/)|(api\.swf#))(.+)$'
     _URL_EXT = r'^.*\.([a-z0-9]+)$'
     _URL_EXT = r'^.*\.([a-z0-9]+)$'
     IE_NAME = u'blip.tv'
     IE_NAME = u'blip.tv'
     _TEST = {
     _TEST = {
@@ -58,7 +58,6 @@ class BlipTVIE(InfoExtractor):
             url = 'http://blip.tv/a/a-' + file_id
             url = 'http://blip.tv/a/a-' + file_id
             return self._real_extract(url)
             return self._real_extract(url)
 
 
-
         if '?' in url:
         if '?' in url:
             cchar = '&'
             cchar = '&'
         else:
         else:
@@ -71,22 +70,6 @@ class BlipTVIE(InfoExtractor):
         urlh = self._request_webpage(request, None, False,
         urlh = self._request_webpage(request, None, False,
             u'unable to download video info webpage')
             u'unable to download video info webpage')
 
 
-        if urlh.headers.get('Content-Type', '').startswith('video/'): # Direct download
-            basename = url.split('/')[-1]
-            title,ext = os.path.splitext(basename)
-            title = title.decode('UTF-8')
-            ext = ext.replace('.', '')
-            self.report_direct_download(title)
-            return {
-                'id': title,
-                'url': url,
-                'uploader': None,
-                'upload_date': None,
-                'title': title,
-                'ext': ext,
-                'urlhandle': urlh
-            }
-
         try:
         try:
             json_code_bytes = urlh.read()
             json_code_bytes = urlh.read()
             json_code = json_code_bytes.decode('utf-8')
             json_code = json_code_bytes.decode('utf-8')

+ 0 - 2
youtube_dl/extractor/common.py

@@ -63,8 +63,6 @@ class InfoExtractor(object):
     ext:            Video filename extension.
     ext:            Video filename extension.
     format:         The video format, defaults to ext (used for --get-format)
     format:         The video format, defaults to ext (used for --get-format)
     player_url:     SWF Player URL (used for rtmpdump).
     player_url:     SWF Player URL (used for rtmpdump).
-    urlhandle:      [internal] The urlHandle to be used to download the file,
-                    like returned by urllib.request.urlopen
 
 
     The following fields are optional:
     The following fields are optional: