]> jfr.im git - yt-dlp.git/blame - youtube_dl/extractor/videopremium.py
[nfl] Fix test case - download, but don't check md5
[yt-dlp.git] / youtube_dl / extractor / videopremium.py
CommitLineData
ea62a2da
FV
1import re
2import random
3
4from .common import InfoExtractor
5
6
7class VideoPremiumIE(InfoExtractor):
4b19e389 8 _VALID_URL = r'(?:https?://)?(?:www\.)?videopremium\.(?:tv|me)/(?P<id>\w+)(?:/.*)?'
ea62a2da
FV
9 _TEST = {
10 u'url': u'http://videopremium.tv/4w7oadjsf156',
11 u'file': u'4w7oadjsf156.f4v',
12 u'info_dict': {
13 u"title": u"youtube-dl_test_video____a_________-BaW_jenozKc.mp4.mp4"
14 },
15 u'params': {
16 u'skip_download': True,
17 },
78060302 18 u'skip': u'Test file has been deleted.',
ea62a2da
FV
19 }
20
21 def _real_extract(self, url):
22 mobj = re.match(self._VALID_URL, url)
23
24 video_id = mobj.group('id')
25 webpage_url = 'http://videopremium.tv/' + video_id
26 webpage = self._download_webpage(webpage_url, video_id)
27
c4864091
PH
28 if re.match(r"^<html><head><script[^>]*>window.location\s*=", webpage):
29 # Download again, we need a cookie
30 webpage = self._download_webpage(
31 webpage_url, video_id,
32 note=u'Downloading webpage again (with cookie)')
ea62a2da 33
c4864091
PH
34 video_title = self._html_search_regex(
35 r'<h2(?:.*?)>\s*(.+?)\s*<', webpage, u'video title')
ea62a2da 36
c4864091 37 return {
ea62a2da
FV
38 'id': video_id,
39 'url': "rtmp://e%d.md.iplay.md/play" % random.randint(1, 16),
40 'play_path': "mp4:%s.f4v" % video_id,
41 'page_url': "http://videopremium.tv/" + video_id,
42 'player_url': "http://videopremium.tv/uplayer/uppod.swf",
43 'ext': 'f4v',
44 'title': video_title,
4b19e389 45 }