1
0
mirror of https://github.com/l1ving/youtube-dl synced 2024-12-21 22:52:52 +08:00

[fktv] Fix download URL

This commit is contained in:
Philipp Hagemeister 2015-01-08 16:03:13 +01:00
parent d51a853d5c
commit bd6b25ce0e

View File

@ -13,7 +13,7 @@ from ..utils import (
class FKTVIE(InfoExtractor): class FKTVIE(InfoExtractor):
IE_NAME = 'fernsehkritik.tv' IE_NAME = 'fernsehkritik.tv'
_VALID_URL = r'http://(?:www\.)?fernsehkritik\.tv/folge-(?P<ep>[0-9]+)(?:/.*)?' _VALID_URL = r'http://(?:www\.)?fernsehkritik\.tv/folge-(?P<id>[0-9]+)(?:/.*)?'
_TEST = { _TEST = {
'url': 'http://fernsehkritik.tv/folge-1', 'url': 'http://fernsehkritik.tv/folge-1',
@ -26,29 +26,32 @@ class FKTVIE(InfoExtractor):
} }
def _real_extract(self, url): def _real_extract(self, url):
mobj = re.match(self._VALID_URL, url) episode = int(self._match_id(url))
episode = int(mobj.group('ep'))
server = random.randint(2, 4) video_thumbnail = 'http://fernsehkritik.tv/images/magazin/folge%s.jpg' % episode
video_thumbnail = 'http://fernsehkritik.tv/images/magazin/folge%d.jpg' % episode start_webpage = self._download_webpage('http://fernsehkritik.tv/folge-%s/Start' % episode,
start_webpage = self._download_webpage('http://fernsehkritik.tv/folge-%d/Start' % episode,
episode) episode)
playlist = self._search_regex(r'playlist = (\[.*?\]);', start_webpage, playlist = self._search_regex(r'playlist = (\[.*?\]);', start_webpage,
'playlist', flags=re.DOTALL) 'playlist', flags=re.DOTALL)
files = json.loads(re.sub('{[^{}]*?}', '{}', playlist)) files = json.loads(re.sub('{[^{}]*?}', '{}', playlist))
# TODO: return a single multipart video
videos = [] videos = []
for i, _ in enumerate(files, 1): for i, _ in enumerate(files, 1):
video_id = '%04d%d' % (episode, i) video_id = '%04d%d' % (episode, i)
video_url = 'http://dl%d.fernsehkritik.tv/fernsehkritik%d%s.flv' % (server, episode, '' if i == 1 else '-%d' % i) video_url = 'http://fernsehkritik.tv/js/directme.php?file=%s%s.flv' % (episode, '' if i == 1 else '-%d' % i)
videos.append({ videos.append({
'ext': 'flv',
'id': video_id, 'id': video_id,
'url': video_url, 'url': video_url,
'title': clean_html(get_element_by_id('eptitle', start_webpage)), 'title': clean_html(get_element_by_id('eptitle', start_webpage)),
'description': clean_html(get_element_by_id('contentlist', start_webpage)), 'description': clean_html(get_element_by_id('contentlist', start_webpage)),
'thumbnail': video_thumbnail 'thumbnail': video_thumbnail
}) })
return videos return {
'_type': 'multi_video',
'entries': videos,
'id': 'folge-%s' % episode,
}
class FKTVPosteckeIE(InfoExtractor): class FKTVPosteckeIE(InfoExtractor):