mirror of
https://github.com/blackjack4494/yt-dlc.git
synced 2024-08-18 08:19:39 +02:00
Merge pull request #801 from expleo/add_referer_support
This commit is contained in:
commit
3820df0106
@ -27,6 +27,8 @@ which means you can modify it, redistribute it or use it however you like.
|
|||||||
from an initial value of SIZE.
|
from an initial value of SIZE.
|
||||||
--dump-user-agent display the current browser identification
|
--dump-user-agent display the current browser identification
|
||||||
--user-agent UA specify a custom user agent
|
--user-agent UA specify a custom user agent
|
||||||
|
--referer REF specify a custom referer, use if the video access
|
||||||
|
is restricted to one domain
|
||||||
--list-extractors List all supported extractors and the URLs they
|
--list-extractors List all supported extractors and the URLs they
|
||||||
would handle
|
would handle
|
||||||
|
|
||||||
|
@ -1093,7 +1093,10 @@ class VimeoIE(InfoExtractor):
|
|||||||
config = webpage.split(' = {config:')[1].split(',assets:')[0]
|
config = webpage.split(' = {config:')[1].split(',assets:')[0]
|
||||||
config = json.loads(config)
|
config = json.loads(config)
|
||||||
except:
|
except:
|
||||||
self._downloader.report_error(u'unable to extract info section')
|
if re.search('The creator of this video has not given you permission to embed it on this domain.', webpage):
|
||||||
|
self._downloader.report_error(u'The author has restricted the access to this video, try with the "--referer" option')
|
||||||
|
else:
|
||||||
|
self._downloader.report_error(u'unable to extract info section')
|
||||||
return
|
return
|
||||||
|
|
||||||
# Extract title
|
# Extract title
|
||||||
|
@ -140,6 +140,9 @@ def parseOpts(overrideArguments=None):
|
|||||||
help='display the current browser identification', default=False)
|
help='display the current browser identification', default=False)
|
||||||
general.add_option('--user-agent',
|
general.add_option('--user-agent',
|
||||||
dest='user_agent', help='specify a custom user agent', metavar='UA')
|
dest='user_agent', help='specify a custom user agent', metavar='UA')
|
||||||
|
general.add_option('--referer',
|
||||||
|
dest='referer', help='specify a custom referer, use if the video access is restricted to one domain',
|
||||||
|
metavar='REF', default=None)
|
||||||
general.add_option('--list-extractors',
|
general.add_option('--list-extractors',
|
||||||
action='store_true', dest='list_extractors',
|
action='store_true', dest='list_extractors',
|
||||||
help='List all supported extractors and the URLs they would handle', default=False)
|
help='List all supported extractors and the URLs they would handle', default=False)
|
||||||
@ -342,6 +345,10 @@ def _real_main(argv=None):
|
|||||||
# Set user agent
|
# Set user agent
|
||||||
if opts.user_agent is not None:
|
if opts.user_agent is not None:
|
||||||
std_headers['User-Agent'] = opts.user_agent
|
std_headers['User-Agent'] = opts.user_agent
|
||||||
|
|
||||||
|
# Set referer
|
||||||
|
if opts.referer is not None:
|
||||||
|
std_headers['Referer'] = opts.referer
|
||||||
|
|
||||||
# Dump user agent
|
# Dump user agent
|
||||||
if opts.dump_user_agent:
|
if opts.dump_user_agent:
|
||||||
|
Loading…
Reference in New Issue
Block a user