2013-09-18 17:32:37 -04:00
|
|
|
import re
|
|
|
|
import random
|
|
|
|
import json
|
2013-09-16 08:45:14 -04:00
|
|
|
|
|
|
|
from .common import InfoExtractor
|
|
|
|
from ..utils import (
|
|
|
|
determine_ext,
|
2013-09-18 17:32:37 -04:00
|
|
|
get_element_by_id,
|
|
|
|
clean_html,
|
2013-09-16 08:45:14 -04:00
|
|
|
)
|
|
|
|
|
2013-09-18 17:32:37 -04:00
|
|
|
|
2013-09-16 08:45:14 -04:00
|
|
|
class FKTVIE(InfoExtractor):
|
2013-09-18 17:32:37 -04:00
|
|
|
IE_NAME = u'fernsehkritik.tv'
|
2013-12-04 08:34:47 -05:00
|
|
|
_VALID_URL = r'(?:http://)?(?:www\.)?fernsehkritik\.tv/folge-(?P<ep>[0-9]+)(?:/.*)?'
|
2013-09-16 08:45:14 -04:00
|
|
|
|
2013-09-18 17:32:37 -04:00
|
|
|
_TEST = {
|
|
|
|
u'url': u'http://fernsehkritik.tv/folge-1',
|
|
|
|
u'file': u'00011.flv',
|
|
|
|
u'info_dict': {
|
|
|
|
u'title': u'Folge 1 vom 10. April 2007',
|
|
|
|
u'description': u'md5:fb4818139c7cfe6907d4b83412a6864f',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
def _real_extract(self, url):
|
2013-09-16 08:45:14 -04:00
|
|
|
mobj = re.match(self._VALID_URL, url)
|
|
|
|
episode = int(mobj.group('ep'))
|
2013-09-18 17:32:37 -04:00
|
|
|
|
|
|
|
server = random.randint(2, 4)
|
2013-09-16 08:45:14 -04:00
|
|
|
video_thumbnail = 'http://fernsehkritik.tv/images/magazin/folge%d.jpg' % episode
|
2013-09-18 17:32:37 -04:00
|
|
|
start_webpage = self._download_webpage('http://fernsehkritik.tv/folge-%d/Start' % episode,
|
|
|
|
episode)
|
|
|
|
playlist = self._search_regex(r'playlist = (\[.*?\]);', start_webpage,
|
|
|
|
u'playlist', flags=re.DOTALL)
|
|
|
|
files = json.loads(re.sub('{[^{}]*?}', '{}', playlist))
|
|
|
|
# TODO: return a single multipart video
|
2013-09-16 08:45:14 -04:00
|
|
|
videos = []
|
2013-09-18 17:32:37 -04:00
|
|
|
for i, _ in enumerate(files, 1):
|
2013-09-16 08:45:14 -04:00
|
|
|
video_id = '%04d%d' % (episode, i)
|
2013-09-18 17:32:37 -04:00
|
|
|
video_url = 'http://dl%d.fernsehkritik.tv/fernsehkritik%d%s.flv' % (server, episode, '' if i == 1 else '-%d' % i)
|
2013-09-16 08:45:14 -04:00
|
|
|
videos.append({
|
2013-09-18 17:32:37 -04:00
|
|
|
'id': video_id,
|
|
|
|
'url': video_url,
|
|
|
|
'ext': determine_ext(video_url),
|
|
|
|
'title': clean_html(get_element_by_id('eptitle', start_webpage)),
|
|
|
|
'description': clean_html(get_element_by_id('contentlist', start_webpage)),
|
2013-09-16 08:45:14 -04:00
|
|
|
'thumbnail': video_thumbnail
|
|
|
|
})
|
|
|
|
return videos
|
|
|
|
|
2013-09-18 17:32:37 -04:00
|
|
|
|
2013-09-16 08:45:14 -04:00
|
|
|
class FKTVPosteckeIE(InfoExtractor):
|
2013-09-18 17:32:37 -04:00
|
|
|
IE_NAME = u'fernsehkritik.tv:postecke'
|
2013-12-04 08:34:47 -05:00
|
|
|
_VALID_URL = r'(?:http://)?(?:www\.)?fernsehkritik\.tv/inline-video/postecke\.php\?(.*&)?ep=(?P<ep>[0-9]+)(&|$)'
|
2013-09-16 08:45:14 -04:00
|
|
|
_TEST = {
|
|
|
|
u'url': u'http://fernsehkritik.tv/inline-video/postecke.php?iframe=true&width=625&height=440&ep=120',
|
|
|
|
u'file': u'0120.flv',
|
|
|
|
u'md5': u'262f0adbac80317412f7e57b4808e5c4',
|
|
|
|
u'info_dict': {
|
|
|
|
u"title": u"Postecke 120"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-09-18 17:32:37 -04:00
|
|
|
def _real_extract(self, url):
|
2013-09-16 08:45:14 -04:00
|
|
|
mobj = re.match(self._VALID_URL, url)
|
|
|
|
episode = int(mobj.group('ep'))
|
2013-09-18 17:32:37 -04:00
|
|
|
|
|
|
|
server = random.randint(2, 4)
|
2013-09-16 08:45:14 -04:00
|
|
|
video_id = '%04d' % episode
|
|
|
|
video_url = 'http://dl%d.fernsehkritik.tv/postecke/postecke%d.flv' % (server, episode)
|
|
|
|
video_title = 'Postecke %d' % episode
|
2013-09-18 17:32:37 -04:00
|
|
|
return {
|
2013-09-16 08:45:14 -04:00
|
|
|
'id': video_id,
|
|
|
|
'url': video_url,
|
|
|
|
'ext': determine_ext(video_url),
|
|
|
|
'title': video_title,
|
2013-09-18 17:32:37 -04:00
|
|
|
}
|