pass referer to get_info

This commit is contained in:
j 2020-11-08 22:54:49 +01:00
parent 41fce072a3
commit 1bba157f7f

View file

@ -36,8 +36,10 @@ info_key_map = {
'display_id': 'id',
}
def get_info(url):
def get_info(url, referer=None):
cmd = ['youtube-dl', '-j', '--all-subs', url]
if referer:
cmd += ['--referer', referer]
p = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE, close_fds=True)
@ -88,7 +90,7 @@ def add_subtitles(item, media, tmp):
def download(item_id, url, referer=None):
item = Item.objects.get(public_id=item_id)
info = get_info(url)
info = get_info(url, referer)
if not len(info):
return '%s contains no videos' % url
media = info[0]