projects
/
youtube-dl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[keezmovies] Make display_id optional
[youtube-dl]
/
youtube_dl
/
extractor
/
nrk.py
diff --git
a/youtube_dl/extractor/nrk.py
b/youtube_dl/extractor/nrk.py
index 7532f40c18e92ca71caaf38620f2e69552a3dce4..6ded5bd456fa86bf16e1762601889b46f2d68fe9 100644
(file)
--- a/
youtube_dl/extractor/nrk.py
+++ b/
youtube_dl/extractor/nrk.py
@@
-55,7
+55,9
@@
class NRKBaseIE(InfoExtractor):
for subtitle in ('webVtt', 'timedText'):
subtitle_url = asset.get('%sSubtitlesUrl' % subtitle)
if subtitle_url:
for subtitle in ('webVtt', 'timedText'):
subtitle_url = asset.get('%sSubtitlesUrl' % subtitle)
if subtitle_url:
- subtitles.setdefault('no', []).append({'url': subtitle_url})
+ subtitles.setdefault('no', []).append({
+ 'url': compat_urllib_parse_unquote(subtitle_url)
+ })
entries.append({
'id': asset.get('carrierId') or entry_id,
'title': entry_title,
entries.append({
'id': asset.get('carrierId') or entry_id,
'title': entry_title,
@@
-161,7
+163,7
@@
class NRKTVIE(NRKBaseIE):
'ext': 'mp4',
'title': '20 spørsmål 23.05.2014',
'description': 'md5:bdea103bc35494c143c6a9acdd84887a',
'ext': 'mp4',
'title': '20 spørsmål 23.05.2014',
'description': 'md5:bdea103bc35494c143c6a9acdd84887a',
- 'duration': 1741
.52
,
+ 'duration': 1741,
},
}, {
'url': 'https://tv.nrk.no/program/mdfp15000514',
},
}, {
'url': 'https://tv.nrk.no/program/mdfp15000514',
@@
-171,7
+173,7
@@
class NRKTVIE(NRKBaseIE):
'ext': 'mp4',
'title': 'Grunnlovsjubiléet - Stor ståhei for ingenting 24.05.2014',
'description': 'md5:89290c5ccde1b3a24bb8050ab67fe1db',
'ext': 'mp4',
'title': 'Grunnlovsjubiléet - Stor ståhei for ingenting 24.05.2014',
'description': 'md5:89290c5ccde1b3a24bb8050ab67fe1db',
- 'duration': 4605
.08
,
+ 'duration': 4605,
},
}, {
# single playlist video
},
}, {
# single playlist video
@@
-258,30
+260,34
@@
class NRKPlaylistIE(InfoExtractor):
class NRKSkoleIE(InfoExtractor):
IE_DESC = 'NRK Skole'
class NRKSkoleIE(InfoExtractor):
IE_DESC = 'NRK Skole'
- _VALID_URL = r'https?://(?:www\.)?nrk\.no/skole/
klippdetalj?.*\btopic=(?P<id>[^/?#&]
+)'
+ _VALID_URL = r'https?://(?:www\.)?nrk\.no/skole/
?\?.*\bmediaId=(?P<id>\d
+)'
_TESTS = [{
_TESTS = [{
- 'url': 'http
://nrk.no/skole/klippdetalj?topic=nrk:klipp/616532
',
- 'md5': '
04cd85877cc1913bce73c5d28a47e00f
',
+ 'url': 'http
s://www.nrk.no/skole/?page=search&q=&mediaId=14099
',
+ 'md5': '
6bc936b01f9dd8ed45bc58b252b2d9b6
',
'info_dict': {
'id': '6021',
'info_dict': {
'id': '6021',
- 'ext': '
flv
',
+ 'ext': '
mp4
',
'title': 'Genetikk og eneggede tvillinger',
'description': 'md5:3aca25dcf38ec30f0363428d2b265f8d',
'duration': 399,
},
}, {
'title': 'Genetikk og eneggede tvillinger',
'description': 'md5:3aca25dcf38ec30f0363428d2b265f8d',
'duration': 399,
},
}, {
- 'url': 'http://www.nrk.no/skole/klippdetalj?topic=nrk%3Aklipp%2F616532#embed',
- 'only_matching': True,
- }, {
- 'url': 'http://www.nrk.no/skole/klippdetalj?topic=urn:x-mediadb:21379',
+ 'url': 'https://www.nrk.no/skole/?page=objectives&subject=naturfag&objective=K15114&mediaId=19355',
'only_matching': True,
}]
def _real_extract(self, url):
'only_matching': True,
}]
def _real_extract(self, url):
- video_id = compat_urllib_parse_unquote(self._match_id(url))
+ video_id = self._match_id(url)
+
+ webpage = self._download_webpage(
+ 'https://mimir.nrk.no/plugin/1.0/static?mediaId=%s' % video_id,
+ video_id)
- webpage = self._download_webpage(url, video_id)
+ nrk_id = self._parse_json(
+ self._search_regex(
+ r'<script[^>]+type=["\']application/json["\'][^>]*>({.+?})</script>',
+ webpage, 'application json'),
+ video_id)['activeMedia']['psId']
- nrk_id = self._search_regex(r'data-nrk-id=["\'](\d+)', webpage, 'nrk id')
return self.url_result('nrk:%s' % nrk_id)
return self.url_result('nrk:%s' % nrk_id)