Updated README
[youtube-dl] / youtube_dl / __init__.py
index f60fb841e35e50eb576274f46ce7d776cb8c7ccf..16e74785f6f0996cef56ff5d6d628f57e3790394 100644 (file)
@@ -140,6 +140,8 @@ def parseOpts(overrideArguments=None):
             help='display the current browser identification', default=False)
     general.add_option('--user-agent',
             dest='user_agent', help='specify a custom user agent', metavar='UA')
+    general.add_option('--referer',
+            dest='referer', help='specify a custom referer', metavar='REF', default=None)
     general.add_option('--list-extractors',
             action='store_true', dest='list_extractors',
             help='List all supported extractors and the URLs they would handle', default=False)
@@ -165,7 +167,8 @@ def parseOpts(overrideArguments=None):
 
 
     video_format.add_option('-f', '--format',
-            action='store', dest='format', metavar='FORMAT', help='video format code')
+            action='store', dest='format', metavar='FORMAT',
+            help='video format code, specifiy the order of preference using slashes: "-f 22/17/18"')
     video_format.add_option('--all-formats',
             action='store_const', dest='format', help='download all available video formats', const='all')
     video_format.add_option('--prefer-free-formats',
@@ -315,11 +318,10 @@ def parseOpts(overrideArguments=None):
         commandLineConf = sys.argv[1:] 
         argv = systemConf + userConf + commandLineConf
         opts, args = parser.parse_args(argv)
-
-    if opts.verbose:
-        print(u'[debug] System config: ' + repr(systemConf))
-        print(u'[debug] User config: ' + repr(userConf))
-        print(u'[debug] Command-line args: ' + repr(commandLineConf))
+        if opts.verbose:
+            print(u'[debug] System config: ' + repr(systemConf))
+            print(u'[debug] User config: ' + repr(userConf))
+            print(u'[debug] Command-line args: ' + repr(commandLineConf))
 
     return parser, opts, args
 
@@ -342,6 +344,10 @@ def _real_main(argv=None):
     # Set user agent
     if opts.user_agent is not None:
         std_headers['User-Agent'] = opts.user_agent
+    
+    # Set referer
+    if opts.referer is not None:
+        std_headers['Referer'] = opts.referer
 
     # Dump user agent
     if opts.dump_user_agent: