diff options
| author | Sergey M․ <dstftw@gmail.com> | 2017-02-21 23:14:33 +0700 | 
|---|---|---|
| committer | Sergey M․ <dstftw@gmail.com> | 2017-02-21 23:14:33 +0700 | 
| commit | eea0716cae1290fe08faea89e24a58ec91098638 (patch) | |
| tree | a3710512645f6f74cfcb69d1d83f9a6e880469ec | |
| parent | 336a76551b92db1c040cbf3c4a9b1857e125ad45 (diff) | |
[extractor/common] Print origin country for fake IP
| -rw-r--r-- | youtube_dl/extractor/common.py | 9 | 
1 files changed, 6 insertions, 3 deletions
| diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index a34fbbc9b..4252d6825 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -415,7 +415,8 @@ class InfoExtractor(object):                  self._x_forwarded_for_ip = GeoUtils.random_ipv4(country_code)                  if self._downloader.params.get('verbose', False):                      self._downloader.to_stdout( -                        '[debug] Using fake %s IP as X-Forwarded-For.' % self._x_forwarded_for_ip) +                        '[debug] Using fake IP %s (%s) as X-Forwarded-For.' +                        % (self._x_forwarded_for_ip, country_code.upper()))      def extract(self, url):          """Extracts URL information and returns it in list of dicts.""" @@ -444,10 +445,12 @@ class InfoExtractor(object):                  self._downloader.params.get('geo_bypass', True) and                  not self._x_forwarded_for_ip and                  countries): -            self._x_forwarded_for_ip = GeoUtils.random_ipv4(random.choice(countries)) +            country_code = random.choice(countries) +            self._x_forwarded_for_ip = GeoUtils.random_ipv4(country_code)              if self._x_forwarded_for_ip:                  self.report_warning( -                    'Video is geo restricted. Retrying extraction with fake %s IP as X-Forwarded-For.' % self._x_forwarded_for_ip) +                    'Video is geo restricted. Retrying extraction with fake IP %s (%s) as X-Forwarded-For.' +                    % (self._x_forwarded_for_ip, country_code.upper()))                  return True          return False | 
