import re
+import urllib.parse
from .common import InfoExtractor
-from ..compat import (
- compat_str,
- compat_urlparse,
-)
from ..utils import (
- determine_ext,
ExtractorError,
+ determine_ext,
int_or_none,
parse_iso8601,
remove_end,
'timestamp': 1344154740,
'upload_date': '20120805',
'view_count': int,
- }
+ },
}, {
# single video embedded via iframe
'url': 'https://life.ru/t/новости/152125',
'timestamp': 1427961840,
'upload_date': '20150402',
'view_count': int,
- }
+ },
}, {
# two videos embedded via iframe
'url': 'https://life.ru/t/новости/153461',
webpage)
if not video_urls and not iframe_links:
- raise ExtractorError('No media links available for %s' % video_id)
+ raise ExtractorError(f'No media links available for {video_id}')
title = remove_end(
self._og_search_title(webpage),
def make_entry(video_id, video_url, index=None):
cur_info = dict(common_info)
cur_info.update({
- 'id': video_id if not index else '%s-video%s' % (video_id, index),
+ 'id': video_id if not index else f'{video_id}-video{index}',
'url': video_url,
- 'title': title if not index else '%s (Видео %s)' % (title, index),
+ 'title': title if not index else f'{title} (Видео {index})',
})
return cur_info
def make_video_entry(video_id, video_url, index=None):
- video_url = compat_urlparse.urljoin(url, video_url)
+ video_url = urllib.parse.urljoin(url, video_url)
return make_entry(video_id, video_url, index)
def make_iframe_entry(video_id, video_url, index=None):
'ext': 'mp4',
'title': 'e50c2dec2867350528e2574c899b8291',
'thumbnail': r're:http://.*\.jpg',
- }
+ },
}, {
# with 1080p
'url': 'https://embed.life.ru/video/e50c2dec2867350528e2574c899b8291',
video_id).get('playlist', {})
if playlist:
master = playlist.get('master')
- if isinstance(master, compat_str) and determine_ext(master) == 'm3u8':
- extract_m3u8(compat_urlparse.urljoin(url, master))
+ if isinstance(master, str) and determine_ext(master) == 'm3u8':
+ extract_m3u8(urllib.parse.urljoin(url, master))
original = playlist.get('original')
- if isinstance(original, compat_str):
+ if isinstance(original, str):
extract_original(original)
thumbnail = playlist.get('image')
# Old rendition fallback
if not formats:
for video_url in re.findall(r'"file"\s*:\s*"([^"]+)', webpage):
- video_url = compat_urlparse.urljoin(url, video_url)
+ video_url = urllib.parse.urljoin(url, video_url)
if determine_ext(video_url) == 'm3u8':
extract_m3u8(video_url)
else:
extract_original(video_url)
- self._sort_formats(formats)
-
thumbnail = thumbnail or self._search_regex(
r'"image"\s*:\s*"([^"]+)', webpage, 'thumbnail', default=None)