logo

youtube-dl

[mirror] Download/Watch videos from video hostersgit clone https://hacktivis.me/git/mirror/youtube-dl.git

stretchinternet.py (1339B)


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