[youtube] Fix extraction.
[youtube-dl] / youtube_dl / extractor / stretchinternet.py
index 9a0ec0e650689879ef92cec2f5a2b99185a97dcc..4dbead2ba428abdbfc678aea31403b998a1eb06c 100644 (file)
@@ -1,28 +1,32 @@
-# coding: utf-8
 from __future__ import unicode_literals
 
 from .common import InfoExtractor
+from ..utils import int_or_none
 
 
 class StretchInternetIE(InfoExtractor):
-    IE_DESC = 'StretchInternet'
-    _VALID_URL = r'https?://.*?stretchinternet\.com/[^/_?].*(?<=eventId=)(?P<id>.*)(?=&).*'
+    _VALID_URL = r'https?://portal\.stretchinternet\.com/[^/]+/(?:portal|full)\.htm\?.*?\beventId=(?P<id>\d+)'
     _TEST = {
-        'url': 'https://portal.stretchinternet.com/umary/portal.htm?eventId=313900&streamType=video',
+        'url': 'https://portal.stretchinternet.com/umary/portal.htm?eventId=573272&streamType=video',
         'info_dict': {
-            'id': '313900',
+            'id': '573272',
             'ext': 'mp4',
-            'title': 'StretchInternet'
+            'title': 'University of Mary Wrestling vs. Upper Iowa',
+            'timestamp': 1575668361,
+            'upload_date': '20191206',
         }
     }
 
     def _real_extract(self, url):
         video_id = self._match_id(url)
-        stream = self._download_json('https://neo-client.stretchinternet.com/streamservice/v1/media/stream/v%s' % video_id, video_id)
-        stream_url = stream.get('source')
+
+        event = self._download_json(
+            'https://api.stretchinternet.com/trinity/event/tcg/' + video_id,
+            video_id)[0]
+
         return {
-            'ie_key': 'Generic',
             'id': video_id,
-            'url': 'http://%s' % stream_url,
-            'title': 'StretchInternet'
+            'title': event['title'],
+            'timestamp': int_or_none(event.get('dateCreated'), 1000),
+            'url': 'https://' + event['media'][0]['url'],
         }