2 from __future__ import unicode_literals
\r
4 from .common import InfoExtractor
\r
8 class JojIE(InfoExtractor):
\r
9 _VALID_URL = r'https?://[a-z0-9]+\.joj\.sk/([^/]+/)*(?P<title_query>(?P<release_date>[0-9]{4}(-[0-9]{2}){2}).*)' # noqa
\r
11 'url': 'https://www.joj.sk/nove-byvanie/archiv/2017-05-28-nove-byvanie', # noqa
\r
13 'id': 'a388ec4c-6019-4a4a-9312-b1bee194e932',
\r
15 'title': 'Nové Bývanie',
\r
16 'release_date': '20170528'
\r
19 'url': 'http://nasi.joj.sk/epizody/2016-09-06-stari-rodicia',
\r
21 'id': 'f18b2c5f-9ea8-4941-a164-a814c53306ad',
\r
23 'title': 'Starí Rodičia',
\r
24 'release_date': '20160906'
\r
28 media_src_url = 'http://n16.joj.sk/storage/'
\r
29 xml_source_url = 'https://media.joj.sk/services/Video.php?clip='
\r
31 def _real_extract(self, url):
\r
32 mobj = re.match(self._VALID_URL, url)
\r
33 release_date = mobj.group('release_date').replace('-', '')
\r
34 webpage = self._download_webpage(url, 'id')
\r
35 video_id = self._html_search_regex(
\r
36 r'https?://([a-z0-9]+\.)joj\.sk/embed/(?P<video_id>[a-f0-9\-]+)',
\r
37 webpage, 'id', group='video_id')
\r
38 xml_playlist_url = self.xml_source_url + video_id
\r
39 xml_playlist_et = self._download_xml(xml_playlist_url, 'XML playlist')
\r
41 for file_el in xml_playlist_et.findall('files/file'):
\r
43 height = int(file_el.attrib['id'].replace('p', ''))
\r
46 formats.append({'height': height,
\r
47 'url': self.media_src_url + file_el.attrib['path'].replace( # noqa
\r
49 self._sort_formats(formats)
\r
53 'title': self._og_search_title(webpage).title(),
\r
55 'release_date': release_date
\r