stretchinternet.py 927 B

12345678910111213141516171819202122232425262728
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. class StretchInternetIE(InfoExtractor):
  5. IE_DESC = 'StretchInternet'
  6. _VALID_URL = r'https?://.*?stretchinternet\.com/[^/_?].*(?<=eventId=)(?P<id>.*)(?=&).*'
  7. _TEST = {
  8. 'url': 'https://portal.stretchinternet.com/umary/portal.htm?eventId=313900&streamType=video',
  9. 'info_dict': {
  10. 'id': '313900',
  11. 'ext': 'mp4',
  12. 'title': 'StretchInternet'
  13. }
  14. }
  15. def _real_extract(self, url):
  16. video_id = self._match_id(url)
  17. stream = self._download_json('https://neo-client.stretchinternet.com/streamservice/v1/media/stream/v%s' % video_id, video_id)
  18. stream_url = stream.get('source')
  19. return {
  20. 'ie_key': 'Generic',
  21. 'id': video_id,
  22. 'url': 'http://%s' % stream_url,
  23. 'title': 'StretchInternet'
  24. }