mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-23 08:26:50 +00:00
[pbs] fix extraction for geo restricted videos(#7095)
This commit is contained in:
parent
954529c10f
commit
5aaf012a4e
@ -350,6 +350,15 @@ class PBSIE(InfoExtractor):
|
||||
410: 'This video has expired and is no longer available for online streaming.',
|
||||
}
|
||||
|
||||
def _real_initialize(self):
|
||||
cookie = (self._download_json(
|
||||
'http://localization.services.pbs.org/localize/auto/cookie/',
|
||||
None, headers=self.geo_verification_headers(), fatal=False) or {}).get('cookie')
|
||||
if cookie:
|
||||
station = self._search_regex(r'#?s=\["([^"]+)"', cookie, 'station')
|
||||
if station:
|
||||
self._set_cookie('.pbs.org', 'pbsol.station', station)
|
||||
|
||||
def _extract_webpage(self, url):
|
||||
mobj = re.match(self._VALID_URL, url)
|
||||
|
||||
@ -476,7 +485,8 @@ class PBSIE(InfoExtractor):
|
||||
|
||||
redirect_info = self._download_json(
|
||||
'%s?format=json' % redirect['url'], display_id,
|
||||
'Downloading %s video url info' % (redirect_id or num))
|
||||
'Downloading %s video url info' % (redirect_id or num),
|
||||
headers=self.geo_verification_headers())
|
||||
|
||||
if redirect_info['status'] == 'error':
|
||||
raise ExtractorError(
|
||||
|
Loading…
Reference in New Issue
Block a user