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