]> jfr.im git - yt-dlp.git/blame - yt_dlp/extractor/streamff.py
[extractor/rutube] Extract chapters from description (#6345)
[yt-dlp.git] / yt_dlp / extractor / streamff.py
CommitLineData
883ecd54 1from .common import InfoExtractor
2from ..utils import int_or_none, parse_iso8601
3
4
5class StreamFFIE(InfoExtractor):
6 _VALID_URL = r'https?://(?:www\.)?streamff\.com/v/(?P<id>[a-zA-Z0-9]+)'
7
8 _TESTS = [{
9 'url': 'https://streamff.com/v/55cc94',
10 'md5': '8745a67bb5e5c570738efe7983826370',
11 'info_dict': {
12 'id': '55cc94',
13 'ext': 'mp4',
14 'title': '55cc94',
15 'timestamp': 1634764643,
16 'upload_date': '20211020',
17 'view_count': int,
18 }
19 }]
20
21 def _real_extract(self, url):
22 video_id = self._match_id(url)
23 json_data = self._download_json(f'https://streamff.com/api/videos/{video_id}', video_id)
24 return {
25 'id': video_id,
26 'title': json_data.get('name') or video_id,
27 'url': 'https://streamff.com/%s' % json_data['videoLink'],
28 'view_count': int_or_none(json_data.get('views')),
29 'timestamp': parse_iso8601(json_data.get('date')),
30 }