mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-06-21 18:24:47 +00:00
Compare commits
2 Commits
61a1238ff2
...
9737414e19
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9737414e19 | ||
|
|
a6b1ddd718 |
@ -1,6 +1,5 @@
|
|||||||
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,
|
||||||
@ -8,7 +7,11 @@ from ..utils import (
|
|||||||
update_url,
|
update_url,
|
||||||
url_or_none,
|
url_or_none,
|
||||||
)
|
)
|
||||||
from ..utils.traversal import find_element, traverse_obj
|
from ..utils.traversal import (
|
||||||
|
find_element,
|
||||||
|
require,
|
||||||
|
traverse_obj,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class NobelPrizeIE(InfoExtractor):
|
class NobelPrizeIE(InfoExtractor):
|
||||||
@ -41,9 +44,8 @@ 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')
|
||||||
if not (video_id := traverse_obj(parse_qs(url), (('id', 'qid'), 0, any))):
|
video_id = traverse_obj(parse_qs(url), (
|
||||||
raise ExtractorError('Invalid URL', expected=True)
|
('id', 'qid'), 0, any, {require('video ID')}))
|
||||||
|
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@ -53,8 +55,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