You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.6 KiB

  1. from __future__ import unicode_literals
  2. from .common import InfoExtractor
  3. from ..utils import int_or_none
  4. class StretchInternetIE(InfoExtractor):
  5. _VALID_URL = r'https?://portal\.stretchinternet\.com/[^/]+/portal\.htm\?.*?\beventId=(?P<id>\d+)'
  6. _TEST = {
  7. 'url': 'https://portal.stretchinternet.com/umary/portal.htm?eventId=313900&streamType=video',
  8. 'info_dict': {
  9. 'id': '313900',
  10. 'ext': 'mp4',
  11. 'title': 'Augustana (S.D.) Baseball vs University of Mary',
  12. 'description': 'md5:7578478614aae3bdd4a90f578f787438',
  13. 'timestamp': 1490468400,
  14. 'upload_date': '20170325',
  15. }
  16. }
  17. def _real_extract(self, url):
  18. video_id = self._match_id(url)
  19. stream = self._download_json(
  20. 'https://neo-client.stretchinternet.com/streamservice/v1/media/stream/v%s'
  21. % video_id, video_id)
  22. video_url = 'https://%s' % stream['source']
  23. event = self._download_json(
  24. 'https://neo-client.stretchinternet.com/portal-ws/getEvent.json',
  25. video_id, query={
  26. 'clientID': 99997,
  27. 'eventID': video_id,
  28. 'token': 'asdf',
  29. })['event']
  30. title = event.get('title') or event['mobileTitle']
  31. description = event.get('customText')
  32. timestamp = int_or_none(event.get('longtime'))
  33. return {
  34. 'id': video_id,
  35. 'title': title,
  36. 'description': description,
  37. 'timestamp': timestamp,
  38. 'url': video_url,
  39. }