]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/stretchinternet.py
debian/changelog: Annotate with bug being closed.
[youtubedl] / youtube_dl / extractor / stretchinternet.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4 from ..utils import int_or_none
5
6
7 class StretchInternetIE(InfoExtractor):
8 _VALID_URL = r'https?://portal\.stretchinternet\.com/[^/]+/portal\.htm\?.*?\beventId=(?P<id>\d+)'
9 _TEST = {
10 'url': 'https://portal.stretchinternet.com/umary/portal.htm?eventId=313900&streamType=video',
11 'info_dict': {
12 'id': '313900',
13 'ext': 'mp4',
14 'title': 'Augustana (S.D.) Baseball vs University of Mary',
15 'description': 'md5:7578478614aae3bdd4a90f578f787438',
16 'timestamp': 1490468400,
17 'upload_date': '20170325',
18 }
19 }
20
21 def _real_extract(self, url):
22 video_id = self._match_id(url)
23
24 stream = self._download_json(
25 'https://neo-client.stretchinternet.com/streamservice/v1/media/stream/v%s'
26 % video_id, video_id)
27
28 video_url = 'https://%s' % stream['source']
29
30 event = self._download_json(
31 'https://neo-client.stretchinternet.com/portal-ws/getEvent.json',
32 video_id, query={
33 'clientID': 99997,
34 'eventID': video_id,
35 'token': 'asdf',
36 })['event']
37
38 title = event.get('title') or event['mobileTitle']
39 description = event.get('customText')
40 timestamp = int_or_none(event.get('longtime'))
41
42 return {
43 'id': video_id,
44 'title': title,
45 'description': description,
46 'timestamp': timestamp,
47 'url': video_url,
48 }