mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-06-22 02:34:39 +00:00
Compare commits
No commits in common. "9737414e19fb71ea4c0506889afb5b76881e4f3c" and "61a1238ff29eaf1080b6fe7f8d7b5c1ed32d94ce" have entirely different histories.
9737414e19
...
61a1238ff2
@ -1,5 +1,6 @@
|
|||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
ExtractorError,
|
||||||
clean_html,
|
clean_html,
|
||||||
parse_duration,
|
parse_duration,
|
||||||
parse_qs,
|
parse_qs,
|
||||||
@ -7,11 +8,7 @@ from ..utils import (
|
|||||||
update_url,
|
update_url,
|
||||||
url_or_none,
|
url_or_none,
|
||||||
)
|
)
|
||||||
from ..utils.traversal import (
|
from ..utils.traversal import find_element, traverse_obj
|
||||||
find_element,
|
|
||||||
require,
|
|
||||||
traverse_obj,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class NobelPrizeIE(InfoExtractor):
|
class NobelPrizeIE(InfoExtractor):
|
||||||
@ -44,8 +41,9 @@ class NobelPrizeIE(InfoExtractor):
|
|||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
url = update_url(url, netloc='mediaplayer.nobelprize.org')
|
url = update_url(url, netloc='mediaplayer.nobelprize.org')
|
||||||
video_id = traverse_obj(parse_qs(url), (
|
if not (video_id := traverse_obj(parse_qs(url), (('id', 'qid'), 0, any))):
|
||||||
('id', 'qid'), 0, any, {require('video ID')}))
|
raise ExtractorError('Invalid URL', expected=True)
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -55,8 +53,8 @@ class NobelPrizeIE(InfoExtractor):
|
|||||||
{find_element(tag='span', attr='itemprop', value='description')}, {clean_html})),
|
{find_element(tag='span', attr='itemprop', value='description')}, {clean_html})),
|
||||||
'duration': parse_duration(self._html_search_meta('duration', webpage)),
|
'duration': parse_duration(self._html_search_meta('duration', webpage)),
|
||||||
**traverse_obj(next(self._yield_json_ld(webpage, video_id)), {
|
**traverse_obj(next(self._yield_json_ld(webpage, video_id)), {
|
||||||
|
'url': ('contentUrl', {url_or_none}),
|
||||||
'thumbnail': ('thumbnail_url', {lambda x: self._proto_relative_url(x)}, {url_or_none}),
|
'thumbnail': ('thumbnail_url', {lambda x: self._proto_relative_url(x)}, {url_or_none}),
|
||||||
'timestamp': ('uploadDate', {unified_timestamp}),
|
'timestamp': ('uploadDate', {unified_timestamp}),
|
||||||
'url': ('contentUrl', {url_or_none}),
|
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user