From: Sergey M․ Date: Sat, 4 Feb 2017 11:51:33 +0000 (+0700) Subject: [go] Improve geo restriction detection and use geo bypass mechanism X-Git-Url: http://git.oshgnacknak.de/?a=commitdiff_plain;h=e633f21a96f37a96e8ef0fd4d6c1e4d3c0b41fbf;p=youtube-dl [go] Improve geo restriction detection and use geo bypass mechanism --- diff --git a/youtube_dl/extractor/go.py b/youtube_dl/extractor/go.py index f28e6fbf5..ec902c670 100644 --- a/youtube_dl/extractor/go.py +++ b/youtube_dl/extractor/go.py @@ -101,6 +101,10 @@ class GoIE(AdobePassIE): video_id, data=urlencode_postdata(data), headers=self.geo_verification_headers()) errors = entitlement.get('errors', {}).get('errors', []) if errors: + for error in errors: + if error.get('code') == 1002: + self.raise_geo_restricted( + error['message'], countries=['US']) error_message = ', '.join([error['message'] for error in errors]) raise ExtractorError('%s said: %s' % (self.IE_NAME, error_message), expected=True) asset_url += '?' + entitlement['uplynkData']['sessionKey']