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