1 from .common
import InfoExtractor
11 class StreamableIE(InfoExtractor
):
12 _VALID_URL
= r
'https?://streamable\.com/(?:[es]/)?(?P<id>\w+)'
13 _EMBED_REGEX
= [r
'<iframe[^>]+\bsrc=(?P<q1>[\'"])(?P<url>(?:https?:)?//streamable\.com/.+?)(?P=q1)']
16 'url': 'https://streamable.com/dnd1',
17 'md5': '3e3bc5ca088b48c2d436529b64397fef',
21 'title': 'Mikel Oiarzabal scores to make it 0-3 for La Real against Espanyol',
22 'thumbnail': r're:https?://.*\.jpg$',
23 'uploader': 'teabaker',
24 'timestamp': 1454964157.35115,
25 'upload_date': '20160208',
30 # older video without bitrate, width/height, codecs, etc. info
32 'url': 'https://streamable.com/moo',
33 'md5': '2cf6923639b87fba3279ad0df3a64e73',
37 'title': '"Please don
\'t eat me
!"',
38 'thumbnail': r're:https?://.*\.jpg$',
39 'timestamp': 1426115495,
40 'upload_date': '20150311',
46 'url': 'https://streamable.com/e/dnd1',
47 'only_matching': True,
50 'url': 'https://streamable.com/s/okkqk/drxjds',
51 'only_matching': True,
55 def _real_extract(self, url):
56 video_id = self._match_id(url)
58 # Note: Using the ajax API, as the public Streamable API doesn't seem
59 # to return video info like the title properly sometimes, and doesn't
60 # include info like the video duration
61 video = self._download_json(
62 f'https://ajax.streamable.com/videos/{video_id}', video_id)
65 # 0 The video is being uploaded
66 # 1 The video is being processed
67 # 2 The video has at least one file ready
68 # 3 The video is unavailable due to an error
69 status = video.get('status')
72 'This video is currently unavailable. It may still be uploading or processing.',
75 title = video.get('reddit_title') or video['title']
78 for key, info in video['files'].items():
79 if not info.get('url'):
83 'url': self._proto_relative_url(info['url']),
84 'width': int_or_none(info.get('width')),
85 'height': int_or_none(info.get('height')),
86 'filesize': int_or_none(info.get('size')),
87 'fps': int_or_none(info.get('framerate')),
88 'vbr': float_or_none(info.get('bitrate'), 1000),
89 'vcodec': parse_codecs(try_get(info, lambda x: x['input_metadata']['video_codec_name'])).get('vcodec'),
90 'acodec': parse_codecs(try_get(info, lambda x: x['input_metadata']['audio_codec_name'])).get('acodec'),
96 'description': video.get('description'),
97 'thumbnail': self._proto_relative_url(video.get('thumbnail_url')),
98 'uploader': video.get('owner', {}).get('user_name'),
99 'timestamp': float_or_none(video.get('date_added')),
100 'duration': float_or_none(video.get('duration')),
101 'view_count': int_or_none(video.get('plays')),