]> jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/stretchinternet.py
[youtube] Prefer UTC upload date for videos (#2223)
[yt-dlp.git] / yt_dlp / extractor / stretchinternet.py
1 from __future__ import unicode_literals
2
3 from .common import InfoExtractor
4
5
6 class StretchInternetIE(InfoExtractor):
7 _VALID_URL = r'https?://portal\.stretchinternet\.com/[^/]+/(?:portal|full)\.htm\?.*?\beventId=(?P<id>\d+)'
8 _TEST = {
9 'url': 'https://portal.stretchinternet.com/umary/portal.htm?eventId=573272&streamType=video',
10 'info_dict': {
11 'id': '573272',
12 'ext': 'mp4',
13 'title': 'UNIVERSITY OF MARY WRESTLING VS UPPER IOWA',
14 # 'timestamp': 1575668361,
15 # 'upload_date': '20191206',
16 'uploader_id': '99997',
17 }
18 }
19
20 def _real_extract(self, url):
21 video_id = self._match_id(url)
22
23 media_url = self._download_json(
24 'https://core.stretchlive.com/trinity/event/tcg/' + video_id,
25 video_id)[0]['media'][0]['url']
26 event = self._download_json(
27 'https://neo-client.stretchinternet.com/portal-ws/getEvent.json',
28 video_id, query={'eventID': video_id, 'token': 'asdf'})['event']
29
30 return {
31 'id': video_id,
32 'title': event['title'],
33 # TODO: parse US timezone abbreviations
34 # 'timestamp': event.get('dateTimeString'),
35 'url': 'https://' + media_url,
36 'uploader_id': event.get('ownerID'),
37 }