def _vimeo_sort_formats(self, formats):
# Bitrates are completely broken. Single m3u8 may contain entries in kbps and bps
# at the same time without actual units specified. This lead to wrong sorting.
- self._sort_formats(formats, field_preference=('preference', 'height', 'width', 'fps', 'tbr', 'format_id'))
+ # But since yt-dlp prefers 'res,fps' anyway, 'field_preference' is not needed
+ self._sort_formats(formats)
def _parse_config(self, config, video_id):
video_data = config['video']
formats.append({
'format_id': 'live-archive-source',
'url': live_archive_source_url,
- 'preference': 1,
+ 'quality': 10,
})
- for f in formats:
- if f.get('vcodec') == 'none':
- f['preference'] = -50
- elif f.get('acodec') == 'none':
- f['preference'] = -40
-
subtitles = {}
text_tracks = config['request'].get('text_tracks')
if text_tracks:
'is_live': is_live,
}
- def _extract_original_format(self, url, video_id):
+ def _extract_original_format(self, url, video_id, unlisted_hash=None):
+ query = {'action': 'load_download_config'}
+ if unlisted_hash:
+ query['unlisted_hash'] = unlisted_hash
download_data = self._download_json(
- url, video_id, fatal=False,
- query={'action': 'load_download_config'},
+ url, video_id, fatal=False, query=query,
headers={'X-Requested-With': 'XMLHttpRequest'})
if download_data:
source_file = download_data.get('source_file')
'height': int_or_none(source_file.get('height')),
'filesize': parse_filesize(source_file.get('size')),
'format_id': source_name,
- 'preference': 1,
+ 'quality': 1,
}
{
'url': 'https://vimeo.com/160743502/abd0e13fb4',
'only_matching': True,
+ },
+ {
+ # requires passing unlisted_hash(a52724358e) to load_download_config request
+ 'url': 'https://vimeo.com/392479337/a52724358e',
+ 'only_matching': True,
}
# https://gettingthingsdone.com/workflowmap/
# vimeo embed with check-password page protected by Referer header
if config.get('view') == 4:
config = self._verify_player_video_password(redirect_url, video_id, headers)
- vod = config.get('video', {}).get('vod', {})
+ video = config.get('video') or {}
+ vod = video.get('vod') or {}
def is_rented():
if '>You rented this title.<' in webpage:
formats = []
source_format = self._extract_original_format(
- 'https://vimeo.com/' + video_id, video_id)
+ 'https://vimeo.com/' + video_id, video_id, video.get('unlisted_hash'))
if source_format:
formats.append(source_format)
IE_NAME = 'vhx:embed'
_VALID_URL = r'https?://embed\.vhx\.tv/videos/(?P<id>\d+)'
+ @staticmethod
+ def _extract_url(webpage):
+ mobj = re.search(
+ r'<iframe[^>]+src="(https?://embed\.vhx\.tv/videos/\d+[^"]*)"', webpage)
+ return unescapeHTML(mobj.group(1)) if mobj else None
+
def _real_extract(self, url):
video_id = self._match_id(url)
webpage = self._download_webpage(url, video_id)
'ott data'), video_id, js_to_json)['config_url']
config = self._download_json(config_url, video_id)
info = self._parse_config(config, video_id)
+ info['id'] = video_id
self._vimeo_sort_formats(info['formats'])
return info