X-Git-Url: http://git.cielonegro.org/gitweb.cgi?a=blobdiff_plain;f=youtube_dl%2FInfoExtractors.py;h=44b2472c2677334b935f9e0723d53d43cd915a5e;hb=717b1f72ed6070212a72ac823547cb3c776a6264;hp=447695fda798b39c8c3fdac5bf45fdca36fde007;hpb=4408d996fbf2a50323a65adfeb2aa87e5e70fa24;p=youtube-dl.git diff --git a/youtube_dl/InfoExtractors.py b/youtube_dl/InfoExtractors.py index 447695fda..44b2472c2 100644 --- a/youtube_dl/InfoExtractors.py +++ b/youtube_dl/InfoExtractors.py @@ -29,33 +29,34 @@ class InfoExtractor(object): """Information Extractor class. Information extractors are the classes that, given a URL, extract - information from the video (or videos) the URL refers to. This - information includes the real video URL, the video title and simplified - title, author and others. The information is stored in a dictionary - which is then passed to the FileDownloader. The FileDownloader - processes this information possibly downloading the video to the file - system, among other possible outcomes. The dictionaries must include - the following fields: - - id: Video identifier. - url: Final video URL. - uploader: Nickname of the video uploader. - title: Literal title. - ext: Video filename extension. - format: Video format. - player_url: SWF Player URL (may be None). - - The following fields are optional. Their primary purpose is to allow - youtube-dl to serve as the backend for a video search function, such - as the one in youtube2mp3. They are only used when their respective - forced printing functions are called: - - thumbnail: Full URL to a video thumbnail image. - description: One-line video description. + information about the video (or videos) the URL refers to. This + information includes the real video URL, the video title, author and + others. The information is stored in a dictionary which is then + passed to the FileDownloader. The FileDownloader processes this + information possibly downloading the video to the file system, among + other possible outcomes. + + The dictionaries must include the following fields: + + id: Video identifier. + url: Final video URL. + uploader: Nickname of the video uploader. + title: Video title, unescaped. + ext: Video filename extension. + player_url: SWF Player URL (may be None). + + The following fields are optional: + + format: The video format, defaults to ext. Used by --get-format + thumbnail: Full URL to a video thumbnail image. + description One-line video description. Subclasses of this one should re-define the _real_initialize() and _real_extract() methods and define a _VALID_URL regexp. Probably, they should also be added to the list of extractors. + + _real_extract() must return a *list* of information dictionaries as + described above. """ _ready = False @@ -475,6 +476,9 @@ class YoutubeIE(InfoExtractor): # Extension video_extension = self._video_extensions.get(format_param, 'flv') + video_format = '{} - {}'.format(format_param.decode('utf-8') if format_param else video_extension.decode('utf-8'), + self._video_dimensions.get(format_param, '???')) + results.append({ 'id': video_id.decode('utf-8'), 'url': video_real_url.decode('utf-8'), @@ -482,7 +486,7 @@ class YoutubeIE(InfoExtractor): 'upload_date': upload_date, 'title': video_title, 'ext': video_extension.decode('utf-8'), - 'format': (format_param is None and u'NA' or format_param.decode('utf-8')), + 'format': video_format, 'thumbnail': video_thumbnail.decode('utf-8'), 'description': video_description, 'player_url': player_url, @@ -616,7 +620,6 @@ class MetacafeIE(InfoExtractor): 'upload_date': u'NA', 'title': video_title, 'ext': video_extension.decode('utf-8'), - 'format': u'NA', 'player_url': None, }] @@ -715,7 +718,6 @@ class DailymotionIE(InfoExtractor): 'upload_date': video_upload_date, 'title': video_title, 'ext': video_extension.decode('utf-8'), - 'format': u'NA', 'player_url': None, }] @@ -810,7 +812,6 @@ class GoogleIE(InfoExtractor): 'upload_date': u'NA', 'title': video_title, 'ext': video_extension.decode('utf-8'), - 'format': u'NA', 'player_url': None, }] @@ -877,7 +878,6 @@ class PhotobucketIE(InfoExtractor): 'upload_date': u'NA', 'title': video_title, 'ext': video_extension.decode('utf-8'), - 'format': u'NA', 'player_url': None, }] @@ -1282,7 +1282,6 @@ class GenericIE(InfoExtractor): 'upload_date': u'NA', 'title': video_title, 'ext': video_extension.decode('utf-8'), - 'format': u'NA', 'player_url': None, }] @@ -1888,7 +1887,6 @@ class DepositFilesIE(InfoExtractor): 'upload_date': u'NA', 'title': file_title, 'ext': file_extension.decode('utf-8'), - 'format': u'NA', 'player_url': None, }] @@ -2243,7 +2241,6 @@ class MyVideoIE(InfoExtractor): 'upload_date': u'NA', 'title': video_title, 'ext': u'flv', - 'format': u'NA', 'player_url': None, }] @@ -2291,7 +2288,6 @@ class ComedyCentralIE(InfoExtractor): print('%s\t:\t%s\t[%s]' %(x, self._video_extensions.get(x, 'mp4'), self._video_dimensions.get(x, '???'))) - def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) if mobj is None: @@ -2332,10 +2328,19 @@ class ComedyCentralIE(InfoExtractor): epTitle = mobj.group('episode') mMovieParams = re.findall('(?: