commit 34ae0f9d2019c043f86cb31d37ba30fea9c2faf2
parent 74e716bb6401517f8575215d308cd19eedf4e3fe
Author: Philipp Hagemeister <phihag@phihag.de>
Date: Thu, 27 Sep 2012 19:56:29 +0200
Merge branch 'master' of github.com:rg3/youtube-dl
Diffstat:
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py
@@ -190,6 +190,8 @@ def parseOpts():
general.add_option('--dump-user-agent',
action='store_true', dest='dump_user_agent',
help='display the current browser identification', default=False)
+ general.add_option('--user-agent',
+ action='store', dest='useragent', help='specify a custom user agent')
general.add_option('--list-extractors',
action='store_true', dest='list_extractors',
help='List all supported extractors and the URLs they would handle', default=False)
@@ -370,7 +372,10 @@ def _real_main():
jar.load()
except (IOError, OSError), err:
sys.exit(u'ERROR: unable to open cookie file')
-
+ # Set user agent
+ if opts.useragent is not None:
+ std_headers['User-Agent'] = opts.useragent
+
# Dump user agent
if opts.dump_user_agent:
print std_headers['User-Agent']