[extractors] Use http_headers for setting the User-Agent and the Referer
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Sat, 24 Jan 2015 17:19:58 +0000 (18:19 +0100)
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>
Sat, 24 Jan 2015 17:23:53 +0000 (18:23 +0100)
youtube_dl/downloader/http.py
youtube_dl/extractor/appletrailers.py
youtube_dl/extractor/common.py
youtube_dl/extractor/videomega.py
youtube_dl/extractor/wdr.py

index 90a2e4c53935f60ed01f4dbae08e1732c04beeca..4db50ee90ecbde017eeaf380232f5a6edafcbd38 100644 (file)
@@ -24,10 +24,6 @@ class HttpFD(FileDownloader):
 
         # Do not include the Accept-Encoding header
         headers = {'Youtubedl-no-compression': 'True'}
-        if 'user_agent' in info_dict:
-            headers['User-agent'] = info_dict['user_agent']
-        if 'http_referer' in info_dict:
-            headers['Referer'] = info_dict['http_referer']
         add_headers = info_dict.get('http_headers')
         if add_headers:
             headers.update(add_headers)
index 7cd0482c75d7157df218071a2e22ce2904d094b6..70621946d8a8c9de4437d36755d8476f65608318 100644 (file)
@@ -129,7 +129,9 @@ class AppleTrailersIE(InfoExtractor):
                 'thumbnail': thumbnail,
                 'upload_date': upload_date,
                 'uploader_id': uploader_id,
-                'user_agent': 'QuickTime compatible (youtube-dl)',
+                'http_headers': {
+                    'User-Agent': 'QuickTime compatible (youtube-dl)',
+                },
             })
 
         return {
index 03f3f18c83012cdced0e305fe1cc02d69a85bb7c..52340006214cfb3cbc1d54523a668417cf4fd474 100644 (file)
@@ -108,7 +108,6 @@ class InfoExtractor(object):
                                   (quality takes higher priority)
                                  -1 for default (order by other properties),
                                  -2 or smaller for less than default.
-                    * http_referer  HTTP Referer header value to set.
                     * http_method  HTTP method to use for the download.
                     * http_headers  A dictionary of additional HTTP headers
                                  to add to the request.
index fc6e05fe0a2d60f42b1f5eef6d2d2e90994f86b7..27303031620a8c126797bcdd6207d2f2355c74be 100644 (file)
@@ -62,5 +62,7 @@ class VideoMegaIE(InfoExtractor):
             'title': title,
             'formats': formats,
             'thumbnail': thumbnail,
-            'http_referer': iframe_url,
+            'http_headers': {
+                'Referer': iframe_url,
+            },
         }
index 45466e31b7445f8dd8da742308dcc69f2ff1152f..313b9c15ddc576c226e1f4b8ee211bc816e2ebe9 100644 (file)
@@ -169,7 +169,9 @@ class WDRMobileIE(InfoExtractor):
             'title': mobj.group('title'),
             'age_limit': int(mobj.group('age_limit')),
             'url': url,
-            'user_agent': 'mobile',
+            'http_headers': {
+                'User-Agent': 'mobile',
+            },
         }