A feature-rich command-line audio/video downloader
Added support for custom user agents.
hdclarkea46fe2dd441
diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.pyindex 86951840de..d457d6b822 100644--- 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)@@ -368,7 +370,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 agentif opts.dump_user_agent:print std_headers['User-Agent']