]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/streamable.py
e973c867c1a23eeeacbbc706269e50900f4f60b9
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
14 class StreamableIE(InfoExtractor
):
15 _VALID_URL
= r
'https?://streamable\.com/(?:e/)?(?P<id>\w+)'
18 'url': 'https://streamable.com/dnd1',
19 'md5': '3e3bc5ca088b48c2d436529b64397fef',
23 'title': 'Mikel Oiarzabal scores to make it 0-3 for La Real against Espanyol',
24 'thumbnail': r
're:https?://.*\.jpg$',
25 'uploader': 'teabaker',
26 'timestamp': 1454964157.35115,
27 'upload_date': '20160208',
32 # older video without bitrate, width/height, etc. info
34 'url': 'https://streamable.com/moo',
35 'md5': '2cf6923639b87fba3279ad0df3a64e73',
39 'title': '"Please don\'t eat me!"',
40 'thumbnail': r
're:https?://.*\.jpg$',
41 'timestamp': 1426115495,
42 'upload_date': '20150311',
48 'url': 'https://streamable.com/e/dnd1',
49 'only_matching': True,
54 def _extract_url(webpage
):
56 r
'<iframe[^>]+src=(?P<q1>[\'"])(?P<src>(?:https?:)?//streamable\.com/(?:(?!\1).+))(?P=q1)',
59 return mobj.group('src')
61 def _real_extract(self, url):
62 video_id = self._match_id(url)
64 # Note: Using the ajax API, as the public Streamable API doesn't seem
65 # to return video info like the title properly sometimes, and doesn't
66 # include info like the video duration
67 video = self._download_json(
68 'https://streamable.com/ajax/videos/%s' % video_id, video_id)
71 # 0 The video is being uploaded
72 # 1 The video is being processed
73 # 2 The video has at least one file ready
74 # 3 The video is unavailable due to an error
75 status = video.get('status')
78 'This video is currently unavailable. It may still be uploading or processing.',
81 title = video.get('reddit_title') or video['title']
84 for key, info in video['files'].items():
85 if not info.get('url'):
89 'url': self._proto_relative_url(info['url']),
90 'width': int_or_none(info.get('width')),
91 'height': int_or_none(info.get('height')),
92 'filesize': int_or_none(info.get('size')),
93 'fps': int_or_none(info.get('framerate')),
94 'vbr': float_or_none(info.get('bitrate'), 1000)
96 self._sort_formats(formats)
101 'description': video.get('description'),
102 'thumbnail': self._proto_relative_url(video.get('thumbnail_url')),
103 'uploader': video.get('owner', {}).get('user_name'),
104 'timestamp': float_or_none(video.get('date_added')),
105 'duration': float_or_none(video.get('duration')),
106 'view_count': int_or_none(video.get('plays')),