mirror of
https://github.com/soimort/you-get.git
synced 2025-02-12 04:55:21 +03:00
fix for #1612
This commit is contained in:
parent
69a54bfd2c
commit
7b4114dac4
@ -5,6 +5,7 @@ __all__ = ['panda_download']
|
||||
from ..common import *
|
||||
import json
|
||||
import time
|
||||
import requests
|
||||
|
||||
def panda_download(url, output_dir = '.', merge = True, info_only = False, **kwargs):
|
||||
roomid = url[url.rfind('/')+1:]
|
||||
@ -20,13 +21,16 @@ def panda_download(url, output_dir = '.', merge = True, info_only = False, **kwa
|
||||
room_key = data.get('videoinfo')['room_key']
|
||||
plflag = data.get('videoinfo')['plflag'].split('_')
|
||||
status = data.get('videoinfo')['status']
|
||||
if data.get("roominfo")["banned_reason"]:
|
||||
data2 = json.loads(data['videoinfo']['plflag_list'])
|
||||
plflag = data2["backup"][0].split('_')
|
||||
if status is not "2":
|
||||
raise ValueError("The live stream is not online! (status:%s)" % status)
|
||||
real_url = 'http://pl{}.live.panda.tv/live_panda/{}.flv'.format(plflag[1],room_key)
|
||||
|
||||
counter = 0
|
||||
while (requests.head(real_url, allow_redirects=True).status_code == 403):
|
||||
data2 = json.loads(data['videoinfo']['plflag_list'])
|
||||
plflag = data2["backup"][counter].split('_')
|
||||
counter = counter + 1
|
||||
real_url = 'http://pl{}.live.panda.tv/live_panda/{}.flv'.format(plflag[1],room_key)
|
||||
|
||||
print_info(site_info, title, 'flv', float('inf'))
|
||||
if not info_only:
|
||||
download_urls([real_url], title, 'flv', None, output_dir, merge = merge)
|
||||
|
Loading…
Reference in New Issue
Block a user