aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey M․ <dstftw@gmail.com>2017-02-04 18:52:20 +0700
committerSergey M <dstftw@gmail.com>2017-02-19 05:10:08 +0800
commit8ab8066cf08352ad336c3ff594d0ac27f6c809c8 (patch)
tree1b26a6a53bd1fc37aaa90cb46fb8fff7cbce685d
parent01b1aa9ff408ce15b8bbea08dbc190f3282141a5 (diff)
downloadyoutube-dl-8ab8066cf08352ad336c3ff594d0ac27f6c809c8.tar.xz
[pbs] Improve geo restriction detection and use geo bypass mechanism
-rw-r--r--youtube_dl/extractor/pbs.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/youtube_dl/extractor/pbs.py b/youtube_dl/extractor/pbs.py
index 6baed773f..64f47bae3 100644
--- a/youtube_dl/extractor/pbs.py
+++ b/youtube_dl/extractor/pbs.py
@@ -489,11 +489,12 @@ class PBSIE(InfoExtractor):
headers=self.geo_verification_headers())
if redirect_info['status'] == 'error':
+ message = self._ERRORS.get(
+ redirect_info['http_code'], redirect_info['message'])
+ if redirect_info['http_code'] == 403:
+ self.raise_geo_restricted(msg=message, countries=['US'])
raise ExtractorError(
- '%s said: %s' % (
- self.IE_NAME,
- self._ERRORS.get(redirect_info['http_code'], redirect_info['message'])),
- expected=True)
+ '%s said: %s' % (self.IE_NAME, message), expected=True)
format_url = redirect_info.get('url')
if not format_url: