]>
Commit | Line | Data |
---|---|---|
f1f6ca78 AK |
1 | from .common import InfoExtractor |
2 | ||
3 | ||
4 | class StreamanityIE(InfoExtractor): | |
5 | _VALID_URL = r'https?://(?:www\.)?streamanity\.com/video/(?P<id>[A-Za-z0-9]+)' | |
6 | _TESTS = [{ | |
7 | 'url': 'https://streamanity.com/video/9DFPTnuYi8f2', | |
8 | 'md5': '6ab171e8d4a02ad5dcbff6bea44cf5a1', | |
9 | 'info_dict': { | |
10 | 'id': '9DFPTnuYi8f2', | |
11 | 'ext': 'mp4', | |
12 | 'title': 'Bitcoin vs The Lighting Network', | |
13 | 'thumbnail': r're:https://res\.cloudinary\.com/.+\.png', | |
14 | 'description': '', | |
15 | 'uploader': 'Tom Bombadil (Freddy78)', | |
16 | } | |
17 | }, { | |
18 | 'url': 'https://streamanity.com/video/JktOUjSlfzTD', | |
19 | 'md5': '31f131e28abd3377c38be586a59532dc', | |
20 | 'info_dict': { | |
21 | 'id': 'JktOUjSlfzTD', | |
22 | 'ext': 'mp4', | |
23 | 'title': 'Share data when you see it', | |
24 | 'thumbnail': r're:https://res\.cloudinary\.com/.+\.png', | |
25 | 'description': 'Reposting as data should be public and stored on blockchain', | |
26 | 'uploader': 'digitalcurrencydaily', | |
27 | } | |
28 | }] | |
29 | ||
30 | def _real_extract(self, url): | |
31 | video_id = self._match_id(url) | |
32 | video_info = self._download_json( | |
33 | f'https://app.streamanity.com/api/video/{video_id}', video_id)['data']['video'] | |
34 | ||
35 | formats = self._extract_m3u8_formats( | |
36 | f'https://stream.mux.com/{video_info["play_id"]}.m3u8?token={video_info["token"]}', | |
37 | video_id, ext='mp4', m3u8_id='hls') | |
f1f6ca78 AK |
38 | |
39 | return { | |
40 | 'id': video_id, | |
41 | 'title': video_info['title'], | |
42 | 'description': video_info.get('description'), | |
43 | 'uploader': video_info.get('author_name'), | |
44 | 'is_live': False, | |
45 | 'thumbnail': video_info.get('thumb'), | |
46 | 'formats': formats, | |
47 | } |