]>
Commit | Line | Data |
---|---|---|
84408650 | 1 | from .common import InfoExtractor |
2 | from ..utils import format_field, traverse_obj, unified_timestamp | |
3 | ||
4 | ||
5 | class LivestreamfailsIE(InfoExtractor): | |
bf2e1ec6 | 6 | _VALID_URL = r'https?://(?:www\.)?livestreamfails\.com/(?:clip|post)/(?P<id>[0-9]+)' |
84408650 | 7 | _TESTS = [{ |
8 | 'url': 'https://livestreamfails.com/clip/139200', | |
9 | 'md5': '8a03aea1a46e94a05af6410337463102', | |
10 | 'info_dict': { | |
11 | 'id': '139200', | |
12 | 'ext': 'mp4', | |
13 | 'display_id': 'ConcernedLitigiousSalmonPeteZaroll-O8yo9W2L8OZEKhV2', | |
14 | 'title': 'Streamer jumps off a trampoline at full speed', | |
15 | 'creator': 'paradeev1ch', | |
16 | 'thumbnail': r're:^https?://.+', | |
17 | 'timestamp': 1656271785, | |
18 | 'upload_date': '20220626', | |
19 | } | |
bf2e1ec6 | 20 | }, { |
21 | 'url': 'https://livestreamfails.com/post/139200', | |
22 | 'only_matching': True, | |
84408650 | 23 | }] |
24 | ||
25 | def _real_extract(self, url): | |
26 | video_id = self._match_id(url) | |
27 | api_response = self._download_json(f'https://api.livestreamfails.com/clip/{video_id}', video_id) | |
28 | ||
29 | return { | |
30 | 'id': video_id, | |
31 | 'display_id': api_response.get('sourceId'), | |
32 | 'timestamp': unified_timestamp(api_response.get('createdAt')), | |
33 | 'url': f'https://livestreamfails-video-prod.b-cdn.net/video/{api_response["videoId"]}', | |
34 | 'title': api_response.get('label'), | |
35 | 'creator': traverse_obj(api_response, ('streamer', 'label')), | |
36 | 'thumbnail': format_field(api_response, 'imageId', 'https://livestreamfails-image-prod.b-cdn.net/image/%s') | |
37 | } |