stretchinternet.py 1.3 KB

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