mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-04-28 03:25:52 +00:00
Compare commits
2 Commits
61a1238ff2
...
9737414e19
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9737414e19 | ||
|
|
a6b1ddd718 |
@ -1,6 +1,5 @@
|
||||
from .common import InfoExtractor
|
||||
from ..utils import (
|
||||
ExtractorError,
|
||||
clean_html,
|
||||
parse_duration,
|
||||
parse_qs,
|
||||
@ -8,7 +7,11 @@ from ..utils import (
|
||||
update_url,
|
||||
url_or_none,
|
||||
)
|
||||
from ..utils.traversal import find_element, traverse_obj
|
||||
from ..utils.traversal import (
|
||||
find_element,
|
||||
require,
|
||||
traverse_obj,
|
||||
)
|
||||
|
||||
|
||||
class NobelPrizeIE(InfoExtractor):
|
||||
@ -41,9 +44,8 @@ class NobelPrizeIE(InfoExtractor):
|
||||
|
||||
def _real_extract(self, url):
|
||||
url = update_url(url, netloc='mediaplayer.nobelprize.org')
|
||||
if not (video_id := traverse_obj(parse_qs(url), (('id', 'qid'), 0, any))):
|
||||
raise ExtractorError('Invalid URL', expected=True)
|
||||
|
||||
video_id = traverse_obj(parse_qs(url), (
|
||||
('id', 'qid'), 0, any, {require('video ID')}))
|
||||
webpage = self._download_webpage(url, video_id)
|
||||
|
||||
return {
|
||||
@ -53,8 +55,8 @@ class NobelPrizeIE(InfoExtractor):
|
||||
{find_element(tag='span', attr='itemprop', value='description')}, {clean_html})),
|
||||
'duration': parse_duration(self._html_search_meta('duration', webpage)),
|
||||
**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}),
|
||||
'timestamp': ('uploadDate', {unified_timestamp}),
|
||||
'url': ('contentUrl', {url_or_none}),
|
||||
}),
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user