mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2026-08-27 14:23:41 +03:00
Apply suggestions
This commit is contained in:
@@ -1,17 +1,16 @@
|
|||||||
from .common import InfoExtractor
|
from .common import InfoExtractor
|
||||||
from ..utils import (
|
from ..utils import (
|
||||||
|
UnsupportedError,
|
||||||
clean_html,
|
clean_html,
|
||||||
|
int_or_none,
|
||||||
parse_duration,
|
parse_duration,
|
||||||
parse_qs,
|
parse_qs,
|
||||||
|
str_or_none,
|
||||||
unified_timestamp,
|
unified_timestamp,
|
||||||
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):
|
||||||
@@ -43,10 +42,12 @@ class NobelPrizeIE(InfoExtractor):
|
|||||||
}]
|
}]
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
url = update_url(url, netloc='mediaplayer.nobelprize.org')
|
|
||||||
video_id = traverse_obj(parse_qs(url), (
|
video_id = traverse_obj(parse_qs(url), (
|
||||||
('id', 'qid'), 0, any, {require('video ID')}))
|
('id', 'qid'), -1, {int_or_none}, {str_or_none}, any))
|
||||||
webpage = self._download_webpage(url, video_id)
|
if not video_id:
|
||||||
|
raise UnsupportedError(url)
|
||||||
|
webpage = self._download_webpage(
|
||||||
|
update_url(url, netloc='mediaplayer.nobelprize.org'), video_id)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
@@ -55,7 +56,7 @@ 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)), {
|
||||||
'thumbnail': ('thumbnail_url', {lambda x: self._proto_relative_url(x)}, {url_or_none}),
|
'thumbnail': ('thumbnail_url', {self._proto_relative_url}, {url_or_none}),
|
||||||
'timestamp': ('uploadDate', {unified_timestamp}),
|
'timestamp': ('uploadDate', {unified_timestamp}),
|
||||||
'url': ('contentUrl', {url_or_none}),
|
'url': ('contentUrl', {url_or_none}),
|
||||||
}),
|
}),
|
||||||
|
|||||||
Reference in New Issue
Block a user