]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/nova.py
2 from __future__
import unicode_literals
6 from .common
import InfoExtractor
9 class NovaIE(InfoExtractor
):
10 IE_DESC
= 'TN.cz, Prásk.tv, Nova.cz, Novaplus.cz, FANDA.tv, Krásná.cz and Doma.cz'
11 _VALID_URL
= 'http://(?:[^.]+\.)?(?P<site>tv(?:noviny)?|tn|novaplus|vymena|fanda|krasna|doma|prask)\.nova\.cz/(?:[^/]+/)+(?P<id>[^/]+)(?:\.html|/?)'
13 'url': 'http://tvnoviny.nova.cz/clanek/novinky/co-na-sebe-sportaci-praskli-vime-jestli-pujde-hrdlicka-na-materskou.html',
16 'display_id': 'co-na-sebe-sportaci-praskli-vime-jestli-pujde-hrdlicka-na-materskou',
18 'title': 'Duel: Michal Hrdlička a Petr Suchoň',
19 'description': 'md5:d0cc509858eee1b1374111c588c6f5d5',
20 'thumbnail': 're:^https?://.*\.(?:jpg)',
24 'skip_download': True,
27 'url': 'http://tn.nova.cz/clanek/tajemstvi-ukryte-v-podzemi-specialni-nemocnice-v-prazske-krci.html',
28 'md5': '1dd7b9d5ea27bc361f110cd855a19bd3',
31 'display_id': 'tajemstvi-ukryte-v-podzemi-specialni-nemocnice-v-prazske-krci',
33 'title': 'Podzemní nemocnice v pražské Krči',
34 'description': 'md5:f0a42dd239c26f61c28f19e62d20ef53',
35 'thumbnail': 're:^https?://.*\.(?:jpg)',
38 'url': 'http://novaplus.nova.cz/porad/policie-modrava/video/5591-policie-modrava-15-dil-blondynka-na-hrbitove/',
41 'display_id': '5591-policie-modrava-15-dil-blondynka-na-hrbitove',
43 'title': 'Policie Modrava - 15. díl - Blondýnka na hřbitově',
44 'description': 'md5:d804ba6b30bc7da2705b1fea961bddfe',
45 'thumbnail': 're:^https?://.*\.(?:jpg)',
49 'skip_download': True,
52 'url': 'http://sport.tn.nova.cz/clanek/sport/hokej/nhl/zivot-jde-dal-hodnotil-po-vyrazeni-z-playoff-jiri-sekac.html',
53 'only_matching': True,
55 'url': 'http://fanda.nova.cz/clanek/fun-and-games/krvavy-epos-zaklinac-3-divoky-hon-vychazi-vyhrajte-ho-pro-sebe.html',
56 'only_matching': True,
58 'url': 'http://doma.nova.cz/clanek/zdravi/prijdte-se-zapsat-do-registru-kostni-drene-jiz-ve-stredu-3-cervna.html',
59 'only_matching': True,
61 'url': 'http://prask.nova.cz/clanek/novinky/co-si-na-sobe-nase-hvezdy-nechaly-pojistit.html',
62 'only_matching': True,
64 'url': 'http://tv.nova.cz/clanek/novinky/zivot-je-zivot-bondovsky-trailer.html',
65 'only_matching': True,
68 def _real_extract(self
, url
):
69 mobj
= re
.match(self
._VALID
_URL
, url
)
70 display_id
= mobj
.group('id')
71 site
= mobj
.group('site')
73 webpage
= self
._download
_webpage
(url
, display_id
)
75 video_id
= self
._search
_regex
(
76 [r
"(?:media|video_id)\s*:\s*'(\d+)'",
78 r
'id="article_video_(\d+)"',
79 r
'id="player_(\d+)"'],
82 config_url
= self
._search
_regex
(
83 r
'src="(http://tn\.nova\.cz/bin/player/videojs/config\.php\?[^"]+)"',
84 webpage
, 'config url', default
=None)
87 DEFAULT_SITE_ID
= '23000'
89 'tvnoviny': DEFAULT_SITE_ID
,
90 'novaplus': DEFAULT_SITE_ID
,
91 'vymena': DEFAULT_SITE_ID
,
92 'krasna': DEFAULT_SITE_ID
,
98 site_id
= self
._search
_regex
(
99 r
'site=(\d+)', webpage
, 'site id', default
=None) or SITES
.get(site
, DEFAULT_SITE_ID
)
101 config_url
= ('http://tn.nova.cz/bin/player/videojs/config.php?site=%s&media=%s&jsVar=vjsconfig'
102 % (site_id
, video_id
))
104 config
= self
._download
_json
(
105 config_url
, display_id
,
106 'Downloading config JSON',
107 transform_source
=lambda s
: re
.sub(r
'var\s+[\da-zA-Z_]+\s*=\s*({.+?});', r
'\1', s
))
109 mediafile
= config
['mediafile']
110 video_url
= mediafile
['src']
112 m
= re
.search(r
'^(?P<url>rtmpe?://[^/]+/(?P<app>[^/]+?))/&*(?P<playpath>.+)$', video_url
)
115 'url': m
.group('url'),
116 'app': m
.group('app'),
117 'play_path': m
.group('playpath'),
118 'player_path': 'http://tvnoviny.nova.cz/static/shared/app/videojs/video-js.swf',
125 self
._sort
_formats
(formats
)
127 title
= mediafile
.get('meta', {}).get('title') or self
._og
_search
_title
(webpage
)
128 description
= self
._og
_search
_description
(webpage
)
129 thumbnail
= config
.get('poster')
133 'display_id': display_id
,
135 'description': description
,
136 'thumbnail': thumbnail
,