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.

40 lines
1.3 KiB

  1. import re
  2. import random
  3. from .common import InfoExtractor
  4. class VideoPremiumIE(InfoExtractor):
  5. _VALID_URL = r'(?:https?://)?(?:www\.)?videopremium\.tv/(?P<id>\w+)(?:/.*)?'
  6. _TEST = {
  7. u'url': u'http://videopremium.tv/4w7oadjsf156',
  8. u'file': u'4w7oadjsf156.f4v',
  9. u'info_dict': {
  10. u"title": u"youtube-dl_test_video____a_________-BaW_jenozKc.mp4.mp4"
  11. },
  12. u'params': {
  13. u'skip_download': True,
  14. },
  15. }
  16. def _real_extract(self, url):
  17. mobj = re.match(self._VALID_URL, url)
  18. video_id = mobj.group('id')
  19. webpage_url = 'http://videopremium.tv/' + video_id
  20. webpage = self._download_webpage(webpage_url, video_id)
  21. self.report_extraction(video_id)
  22. video_title = self._html_search_regex(r'<h2(?:.*?)>\s*(.+?)\s*<',
  23. webpage, u'video title')
  24. return [{
  25. 'id': video_id,
  26. 'url': "rtmp://e%d.md.iplay.md/play" % random.randint(1, 16),
  27. 'play_path': "mp4:%s.f4v" % video_id,
  28. 'page_url': "http://videopremium.tv/" + video_id,
  29. 'player_url': "http://videopremium.tv/uplayer/uppod.swf",
  30. 'ext': 'f4v',
  31. 'title': video_title,
  32. }]