diff options
| author | sprhawk <465558+sprhawk@users.noreply.github.com> | 2017-12-26 22:27:26 +0800 | 
|---|---|---|
| committer | sprhawk <465558+sprhawk@users.noreply.github.com> | 2017-12-26 22:27:26 +0800 | 
| commit | c33de004e13da11f1ae3cad7310b36500cfb9d28 (patch) | |
| tree | c742e448af6c126eca4b259c85f83177aec54847 /youtube_dl/extractor/common.py | |
| parent | 42a1012c7767306626c5358a18ad3e86417bd7b7 (diff) | |
| parent | db145ee54a57f5ccc89639de8c589eb111a91b19 (diff) | |
Merge branch 'master' of github.com:rg3/youtube-dl into weibo
Diffstat (limited to 'youtube_dl/extractor/common.py')
| -rw-r--r-- | youtube_dl/extractor/common.py | 24 | 
1 files changed, 13 insertions, 11 deletions
| diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py index 80a9c982f..3b79b8cb4 100644 --- a/youtube_dl/extractor/common.py +++ b/youtube_dl/extractor/common.py @@ -301,8 +301,9 @@ class InfoExtractor(object):      There must be a key "entries", which is a list, an iterable, or a PagedList      object, each element of which is a valid dictionary by this specification. -    Additionally, playlists can have "title", "description" and "id" attributes -    with the same semantics as videos (see above). +    Additionally, playlists can have "id", "title", "description", "uploader", +    "uploader_id", "uploader_url" attributes with the same semantics as videos +    (see above).      _type "multi_video" indicates that there are multiple videos that @@ -494,6 +495,16 @@ class InfoExtractor(object):                  self.to_screen('%s' % (note,))              else:                  self.to_screen('%s: %s' % (video_id, note)) + +        # Some sites check X-Forwarded-For HTTP header in order to figure out +        # the origin of the client behind proxy. This allows bypassing geo +        # restriction by faking this header's value to IP that belongs to some +        # geo unrestricted country. We will do so once we encounter any +        # geo restriction error. +        if self._x_forwarded_for_ip: +            if 'X-Forwarded-For' not in headers: +                headers['X-Forwarded-For'] = self._x_forwarded_for_ip +          if isinstance(url_or_request, compat_urllib_request.Request):              url_or_request = update_Request(                  url_or_request, data=data, headers=headers, query=query) @@ -523,15 +534,6 @@ class InfoExtractor(object):          if isinstance(url_or_request, (compat_str, str)):              url_or_request = url_or_request.partition('#')[0] -        # Some sites check X-Forwarded-For HTTP header in order to figure out -        # the origin of the client behind proxy. This allows bypassing geo -        # restriction by faking this header's value to IP that belongs to some -        # geo unrestricted country. We will do so once we encounter any -        # geo restriction error. -        if self._x_forwarded_for_ip: -            if 'X-Forwarded-For' not in headers: -                headers['X-Forwarded-For'] = self._x_forwarded_for_ip -          urlh = self._request_webpage(url_or_request, video_id, note, errnote, fatal, data=data, headers=headers, query=query)          if urlh is False:              assert not fatal | 
