]> Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/stretchinternet.py
New upstream version 2020.05.08
[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|full)\.htm\?.*?\beventId=(?P<id>\d+)'
9 _TEST = {
10 'url': 'https://portal.stretchinternet.com/umary/portal.htm?eventId=573272&streamType=video',
11 'info_dict': {
12 'id': '573272',
13 'ext': 'mp4',
14 'title': 'University of Mary Wrestling vs. Upper Iowa',
15 'timestamp': 1575668361,
16 'upload_date': '20191206',
17 }
18 }
19
20 def _real_extract(self, url):
21 video_id = self._match_id(url)
22
23 event = self._download_json(
24 'https://api.stretchinternet.com/trinity/event/tcg/' + video_id,
25 video_id)[0]
26
27 return {
28 'id': video_id,
29 'title': event['title'],
30 'timestamp': int_or_none(event.get('dateCreated'), 1000),
31 'url': 'https://' + event['media'][0]['url'],
32 }