- video_url = b64decode(compat_urllib_parse_unquote(self._search_regex(
- r'file=([^&]+)', webpage, 'video url')).encode('ascii')).decode('utf-8')
+ def decode_url(quoted_b64_url):
+ return base64.b64decode(compat_urllib_parse_unquote(
+ quoted_b64_url)).encode('ascii').decode('utf-8')
+
+ formats = [{
+ 'url': decode_url(encoded_url),
+ 'format_id': '%sp' % height,
+ 'height': int(height),
+ } for height, encoded_url in re.findall(
+ r'ContentURL_(\d{3,4})[pP][^=]+=([^&]+)', webpage)]
+
+ if not formats:
+ formats.append({
+ 'url': decode_url(self._search_regex(
+ r'file=([^&]+)', webpage, 'video url')),
+ })