[go] Improve geo restriction detection and use geo bypass mechanism

This commit is contained in:
Sergey M․ 2017-02-04 18:51:33 +07:00 committed by Sergey M
parent d392005a79
commit e633f21a96

View file

@ -101,6 +101,10 @@ class GoIE(AdobePassIE):
video_id, data=urlencode_postdata(data), headers=self.geo_verification_headers()) video_id, data=urlencode_postdata(data), headers=self.geo_verification_headers())
errors = entitlement.get('errors', {}).get('errors', []) errors = entitlement.get('errors', {}).get('errors', [])
if 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]) error_message = ', '.join([error['message'] for error in errors])
raise ExtractorError('%s said: %s' % (self.IE_NAME, error_message), expected=True) raise ExtractorError('%s said: %s' % (self.IE_NAME, error_message), expected=True)
asset_url += '?' + entitlement['uplynkData']['sessionKey'] asset_url += '?' + entitlement['uplynkData']['sessionKey']