Upgrade yt_dlp and download script
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
from .common import InfoExtractor
|
||||
from ..utils import (
|
||||
int_or_none,
|
||||
float_or_none,
|
||||
int_or_none,
|
||||
join_nonempty,
|
||||
unified_strdate,
|
||||
)
|
||||
|
||||
@@ -76,7 +77,7 @@ class WSJIE(InfoExtractor):
|
||||
tbr = int_or_none(v.get('bitrate'))
|
||||
formats.append({
|
||||
'url': mp4_url,
|
||||
'format_id': 'http' + ('-%d' % tbr if tbr else ''),
|
||||
'format_id': join_nonempty('http', tbr),
|
||||
'tbr': tbr,
|
||||
'width': int_or_none(v.get('width')),
|
||||
'height': int_or_none(v.get('height')),
|
||||
@@ -99,8 +100,8 @@ class WSJIE(InfoExtractor):
|
||||
|
||||
|
||||
class WSJArticleIE(InfoExtractor):
|
||||
_VALID_URL = r'(?i)https?://(?:www\.)?wsj\.com/articles/(?P<id>[^/?#&]+)'
|
||||
_TEST = {
|
||||
_VALID_URL = r'(?i)https?://(?:www\.)?wsj\.com/(?:articles|opinion)/(?P<id>[^/?#&]+)'
|
||||
_TESTS = [{
|
||||
'url': 'https://www.wsj.com/articles/dont-like-china-no-pandas-for-you-1490366939?',
|
||||
'info_dict': {
|
||||
'id': '4B13FA62-1D8C-45DB-8EA1-4105CB20B362',
|
||||
@@ -108,13 +109,22 @@ class WSJArticleIE(InfoExtractor):
|
||||
'upload_date': '20170221',
|
||||
'uploader_id': 'ralcaraz',
|
||||
'title': 'Bao Bao the Panda Leaves for China',
|
||||
}
|
||||
}
|
||||
},
|
||||
}, {
|
||||
'url': 'https://www.wsj.com/opinion/hamas-hostages-caskets-bibas-family-israel-gaza-29da083b',
|
||||
'info_dict': {
|
||||
'id': 'CE68D629-8DB8-4CD3-B30A-92112C102054',
|
||||
'ext': 'mp4',
|
||||
'upload_date': '20241007',
|
||||
'uploader_id': 'Tinnes, David',
|
||||
'title': 'WSJ Opinion: "Get the Jew": The Crown Heights Riot Revisited',
|
||||
},
|
||||
}]
|
||||
|
||||
def _real_extract(self, url):
|
||||
article_id = self._match_id(url)
|
||||
webpage = self._download_webpage(url, article_id)
|
||||
webpage = self._download_webpage(url, article_id, impersonate=True)
|
||||
video_id = self._search_regex(
|
||||
r'(?:id=["\']video|video-|iframe\.html\?guid=|data-src=["\'])([a-fA-F0-9-]{36})',
|
||||
webpage, 'video id')
|
||||
return self.url_result('wsj:%s' % video_id, WSJIE.ie_key(), video_id)
|
||||
return self.url_result(f'wsj:{video_id}', WSJIE.ie_key(), video_id)
|
||||
|
Reference in New Issue
Block a user