'248': 'webm',
}
_video_dimensions = {
- '5': '400x240',
- '6': '???',
- '13': '???',
- '17': '176x144',
- '18': '640x360',
- '22': '1280x720',
- '34': '640x360',
- '35': '854x480',
- '36': '320x240',
- '37': '1920x1080',
- '38': '4096x3072',
- '43': '640x360',
- '44': '854x480',
- '45': '1280x720',
- '46': '1920x1080',
- '82': '360p',
- '83': '480p',
- '84': '720p',
- '85': '1080p',
- '92': '240p',
- '93': '360p',
- '94': '480p',
- '95': '720p',
- '96': '1080p',
- '100': '360p',
- '101': '480p',
- '102': '720p',
- '132': '240p',
- '151': '72p',
- '133': '240p',
- '134': '360p',
- '135': '480p',
- '136': '720p',
- '137': '1080p',
- '138': '>1080p',
- '139': '48k',
- '140': '128k',
- '141': '256k',
- '160': '192p',
- '171': '128k',
- '172': '256k',
- '242': '240p',
- '243': '360p',
- '244': '480p',
- '245': '480p',
- '246': '480p',
- '247': '720p',
- '248': '1080p',
+ '5': {'width': 400, 'height': 240},
+ '6': {},
+ '13': {},
+ '17': {'width': 176, 'height': 144},
+ '18': {'width': 640, 'height': 360},
+ '22': {'width': 1280, 'height': 720},
+ '34': {'width': 640, 'height': 360},
+ '35': {'width': 854, 'height': 480},
+ '36': {'width': 320, 'height': 240},
+ '37': {'width': 1920, 'height': 1080},
+ '38': {'width': 4096, 'height': 3072},
+ '43': {'width': 640, 'height': 360},
+ '44': {'width': 854, 'height': 480},
+ '45': {'width': 1280, 'height': 720},
+ '46': {'width': 1920, 'height': 1080},
+ '82': {'height': 360, 'display': '360p'},
+ '83': {'height': 480, 'display': '480p'},
+ '84': {'height': 720, 'display': '720p'},
+ '85': {'height': 1080, 'display': '1080p'},
+ '92': {'height': 240, 'display': '240p'},
+ '93': {'height': 360, 'display': '360p'},
+ '94': {'height': 480, 'display': '480p'},
+ '95': {'height': 720, 'display': '720p'},
+ '96': {'height': 1080, 'display': '1080p'},
+ '100': {'height': 360, 'display': '360p'},
+ '101': {'height': 480, 'display': '480p'},
+ '102': {'height': 720, 'display': '720p'},
+ '132': {'height': 240, 'display': '240p'},
+ '151': {'height': 72, 'display': '72p'},
+ '133': {'height': 240, 'display': '240p'},
+ '134': {'height': 360, 'display': '360p'},
+ '135': {'height': 480, 'display': '480p'},
+ '136': {'height': 720, 'display': '720p'},
+ '137': {'height': 1080, 'display': '1080p'},
+ '138': {'height': 1081, 'display': '>1080p'},
+ '139': {'display': '48k'},
+ '140': {'display': '128k'},
+ '141': {'display': '256k'},
+ '160': {'height': 192, 'display': '192p'},
+ '171': {'display': '128k'},
+ '172': {'display': '256k'},
+ '242': {'height': 240, 'display': '240p'},
+ '243': {'height': 360, 'display': '360p'},
+ '244': {'height': 480, 'display': '480p'},
+ '245': {'height': 480, 'display': '480p'},
+ '246': {'height': 480, 'display': '480p'},
+ '247': {'height': 720, 'display': '720p'},
+ '248': {'height': 1080, 'display': '1080p'},
}
_special_itags = {
'82': '3D',
for itag, video_real_url in video_url_list:
# Extension
video_extension = self._video_extensions.get(itag, 'flv')
+ resolution = self._video_dimensions.get(itag, {}).get('display')
+ width = self._video_dimensions.get(itag, {}).get('width')
+ height = self._video_dimensions.get(itag, {}).get('height')
+ note = self._special_itags.get(itag)
video_format = '{0} - {1}{2}'.format(itag if itag else video_extension,
- self._video_dimensions.get(itag, '???'),
+ '%dx%d' % (width, height) if width is not None and height is not None else (resolution if resolution is not None else '???'),
' ('+self._special_itags[itag]+')' if itag in self._special_itags else '')
- note = self._special_itags.get(itag, None)
- resolution = self._video_dimensions.get(itag, None)
formats.append({
'url': video_real_url,
'format_id': itag,
'player_url': player_url,
'_resolution': resolution,
+ 'width': width,
+ 'height': height,
'format_note': note,
})
+ self._sort_formats(formats)
+
return {
'id': video_id,
'uploader': video_uploader,
# page by page until there are no video ids - it means we got
# all of them.
- video_ids = []
+ url_results = []
for pagenum in itertools.count(0):
start_index = pagenum * self._GDATA_PAGE_SIZE + 1
break
# Extract video identifiers
- ids_in_page = []
- for entry in response['feed']['entry']:
- ids_in_page.append(entry['id']['$t'].split('/')[-1])
- video_ids.extend(ids_in_page)
+ entries = response['feed']['entry']
+ for entry in entries:
+ title = entry['title']['$t']
+ video_id = entry['id']['$t'].split('/')[-1]
+ url_results.append({
+ '_type': 'url',
+ 'url': video_id,
+ 'ie_key': 'Youtube',
+ 'id': 'video_id',
+ 'title': title,
+ })
# A little optimization - if current page is not
# "full", ie. does not contain PAGE_SIZE video ids then
# are no more ids on further pages - no need to query
# again.
- if len(ids_in_page) < self._GDATA_PAGE_SIZE:
+ if len(entries) < self._GDATA_PAGE_SIZE:
break
- url_results = [
- self.url_result(video_id, 'Youtube', video_id=video_id)
- for video_id in video_ids]
return self.playlist_result(url_results, playlist_title=username)