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