]> jfr.im git - yt-dlp.git/blobdiff - youtube_dl/__init__.py
Adds support for passing a referer.
[yt-dlp.git] / youtube_dl / __init__.py
index 74375175dd1ebca987de37ceef7af30b34ca5de0..16e74785f6f0996cef56ff5d6d628f57e3790394 100644 (file)
@@ -140,6 +140,8 @@ def _find_term_columns():
             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)
@@ -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: