mirror of
https://github.com/l1ving/youtube-dl
synced 2025-03-10 19:47:14 +08:00
Merge pull request #286 from ytdl-org/master
[pull] master from ytdl-org:master
This commit is contained in:
commit
eb336fac03
@ -7,6 +7,7 @@ from .common import InfoExtractor
|
|||||||
from ..utils import (
|
from ..utils import (
|
||||||
determine_ext,
|
determine_ext,
|
||||||
int_or_none,
|
int_or_none,
|
||||||
|
merge_dicts,
|
||||||
parse_iso8601,
|
parse_iso8601,
|
||||||
qualities,
|
qualities,
|
||||||
try_get,
|
try_get,
|
||||||
@ -87,21 +88,25 @@ class NDRIE(NDRBaseIE):
|
|||||||
|
|
||||||
def _extract_embed(self, webpage, display_id):
|
def _extract_embed(self, webpage, display_id):
|
||||||
embed_url = self._html_search_meta(
|
embed_url = self._html_search_meta(
|
||||||
'embedURL', webpage, 'embed URL', fatal=True)
|
'embedURL', webpage, 'embed URL',
|
||||||
|
default=None) or self._search_regex(
|
||||||
|
r'\bembedUrl["\']\s*:\s*(["\'])(?P<url>(?:(?!\1).)+)\1', webpage,
|
||||||
|
'embed URL', group='url')
|
||||||
description = self._search_regex(
|
description = self._search_regex(
|
||||||
r'<p[^>]+itemprop="description">([^<]+)</p>',
|
r'<p[^>]+itemprop="description">([^<]+)</p>',
|
||||||
webpage, 'description', default=None) or self._og_search_description(webpage)
|
webpage, 'description', default=None) or self._og_search_description(webpage)
|
||||||
timestamp = parse_iso8601(
|
timestamp = parse_iso8601(
|
||||||
self._search_regex(
|
self._search_regex(
|
||||||
r'<span[^>]+itemprop="(?:datePublished|uploadDate)"[^>]+content="([^"]+)"',
|
r'<span[^>]+itemprop="(?:datePublished|uploadDate)"[^>]+content="([^"]+)"',
|
||||||
webpage, 'upload date', fatal=False))
|
webpage, 'upload date', default=None))
|
||||||
return {
|
info = self._search_json_ld(webpage, display_id, default={})
|
||||||
|
return merge_dicts({
|
||||||
'_type': 'url_transparent',
|
'_type': 'url_transparent',
|
||||||
'url': embed_url,
|
'url': embed_url,
|
||||||
'display_id': display_id,
|
'display_id': display_id,
|
||||||
'description': description,
|
'description': description,
|
||||||
'timestamp': timestamp,
|
'timestamp': timestamp,
|
||||||
}
|
}, info)
|
||||||
|
|
||||||
|
|
||||||
class NJoyIE(NDRBaseIE):
|
class NJoyIE(NDRBaseIE):
|
||||||
|
@ -6,7 +6,7 @@ from .common import InfoExtractor
|
|||||||
|
|
||||||
|
|
||||||
class NhkVodIE(InfoExtractor):
|
class NhkVodIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://www3\.nhk\.or\.jp/nhkworld/(?P<lang>[a-z]{2})/ondemand/(?P<type>video|audio)/(?P<id>\d{7}|[a-z]+-\d{8}-\d+)'
|
_VALID_URL = r'https?://www3\.nhk\.or\.jp/nhkworld/(?P<lang>[a-z]{2})/ondemand/(?P<type>video|audio)/(?P<id>\d{7}|[^/]+?-\d{8}-\d+)'
|
||||||
# Content available only for a limited period of time. Visit
|
# Content available only for a limited period of time. Visit
|
||||||
# https://www3.nhk.or.jp/nhkworld/en/ondemand/ for working samples.
|
# https://www3.nhk.or.jp/nhkworld/en/ondemand/ for working samples.
|
||||||
_TESTS = [{
|
_TESTS = [{
|
||||||
@ -30,6 +30,9 @@ class NhkVodIE(InfoExtractor):
|
|||||||
}, {
|
}, {
|
||||||
'url': 'https://www3.nhk.or.jp/nhkworld/fr/ondemand/audio/plugin-20190404-1/',
|
'url': 'https://www3.nhk.or.jp/nhkworld/fr/ondemand/audio/plugin-20190404-1/',
|
||||||
'only_matching': True,
|
'only_matching': True,
|
||||||
|
}, {
|
||||||
|
'url': 'https://www3.nhk.or.jp/nhkworld/en/ondemand/audio/j_art-20150903-1/',
|
||||||
|
'only_matching': True,
|
||||||
}]
|
}]
|
||||||
_API_URL_TEMPLATE = 'https://api.nhk.or.jp/nhkworld/%sod%slist/v7a/episode/%s/%s/all%s.json'
|
_API_URL_TEMPLATE = 'https://api.nhk.or.jp/nhkworld/%sod%slist/v7a/episode/%s/%s/all%s.json'
|
||||||
|
|
||||||
@ -82,15 +85,9 @@ class NhkVodIE(InfoExtractor):
|
|||||||
audio = episode['audio']
|
audio = episode['audio']
|
||||||
audio_path = audio['audio']
|
audio_path = audio['audio']
|
||||||
info['formats'] = self._extract_m3u8_formats(
|
info['formats'] = self._extract_m3u8_formats(
|
||||||
'https://nhks-vh.akamaihd.net/i%s/master.m3u8' % audio_path,
|
'https://nhkworld-vh.akamaihd.net/i%s/master.m3u8' % audio_path,
|
||||||
episode_id, 'm4a', m3u8_id='hls', fatal=False)
|
episode_id, 'm4a', entry_protocol='m3u8_native',
|
||||||
for proto in ('rtmpt', 'rtmp'):
|
m3u8_id='hls', fatal=False)
|
||||||
info['formats'].append({
|
|
||||||
'ext': 'flv',
|
|
||||||
'format_id': proto,
|
|
||||||
'url': '%s://flv.nhk.or.jp/ondemand/mp4:flv%s' % (proto, audio_path),
|
|
||||||
'vcodec': 'none',
|
|
||||||
})
|
|
||||||
for f in info['formats']:
|
for f in info['formats']:
|
||||||
f['language'] = lang
|
f['language'] = lang
|
||||||
return info
|
return info
|
||||||
|
Loading…
x
Reference in New Issue
Block a user