From 28535652abe5d78df3ad84aa9930b3585d35edc8 Mon Sep 17 00:00:00 2001 From: Bjorn Heesakkers Date: Wed, 24 Apr 2013 13:56:04 +0200 Subject: [PATCH 1/2] Adds support for passing a referer. --- youtube_dl/__init__.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index 74375175d..16e74785f 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -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) @@ -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: From 59cc5d9380ee6ffc9032c9a3873b006a824ae934 Mon Sep 17 00:00:00 2001 From: Bjorn Heesakkers Date: Wed, 24 Apr 2013 14:12:33 +0200 Subject: [PATCH 2/2] Updated README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 0ab4b660c..ffb321ff9 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ which means you can modify it, redistribute it or use it however you like. from an initial value of SIZE. --dump-user-agent display the current browser identification --user-agent UA specify a custom user agent + --referer REF specify a custom referer --list-extractors List all supported extractors and the URLs they would handle