forked from 0x2620/pandora
pass referer to get_info
This commit is contained in:
parent
41fce072a3
commit
1bba157f7f
1 changed files with 4 additions and 2 deletions
|
@ -36,8 +36,10 @@ info_key_map = {
|
||||||
'display_id': 'id',
|
'display_id': 'id',
|
||||||
}
|
}
|
||||||
|
|
||||||
def get_info(url):
|
def get_info(url, referer=None):
|
||||||
cmd = ['youtube-dl', '-j', '--all-subs', url]
|
cmd = ['youtube-dl', '-j', '--all-subs', url]
|
||||||
|
if referer:
|
||||||
|
cmd += ['--referer', referer]
|
||||||
p = subprocess.Popen(cmd,
|
p = subprocess.Popen(cmd,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
stderr=subprocess.PIPE, close_fds=True)
|
stderr=subprocess.PIPE, close_fds=True)
|
||||||
|
@ -88,7 +90,7 @@ def add_subtitles(item, media, tmp):
|
||||||
|
|
||||||
def download(item_id, url, referer=None):
|
def download(item_id, url, referer=None):
|
||||||
item = Item.objects.get(public_id=item_id)
|
item = Item.objects.get(public_id=item_id)
|
||||||
info = get_info(url)
|
info = get_info(url, referer)
|
||||||
if not len(info):
|
if not len(info):
|
||||||
return '%s contains no videos' % url
|
return '%s contains no videos' % url
|
||||||
media = info[0]
|
media = info[0]
|
||||||
|
|
Loading…
Reference in a new issue