Skip to content

Commit a107237

Browse files
committed
支持拜年祭视频
1 parent ab6c0d7 commit a107237

2 files changed

Lines changed: 45 additions & 14 deletions

File tree

JSONParser.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,29 @@ def Myparser(s) :
3030
if 'ssList' in obj:
3131
return -1
3232
data={}
33+
if 'activityKey' in obj and obj['activityKey'] == '2021bnj':
34+
vinfo = obj['videoInfo']
35+
data['aid'] = vinfo['aid']
36+
data['bvid'] = vinfo['bvid']
37+
data['videos'] = len(vinfo['pages'])
38+
data['title'] = vinfo['title']
39+
data['pubdate'] = vinfo['pubdate']
40+
data['ctime'] = data['pubdate']
41+
data['desc'] = vinfo['desc']
42+
data['uid'] = vinfo['upMid']
43+
data['name'] = vinfo['upName']
44+
page = []
45+
for i in vinfo['pages']:
46+
for i in vinfo['pages'] :
47+
t = {}
48+
t['cid'] = i['cid']
49+
t['page'] = i['page']
50+
t['part'] = i['part']
51+
t['duration'] = i['duration']
52+
page.append(t)
53+
data['page'] = page
54+
data['tags'] = []
55+
return data
3356
data['aid']=obj['aid']
3457
data['bvid']=obj['videoData']['bvid']
3558
data['videos']=obj['videoData']['videos']

videodownload.py

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -736,10 +736,12 @@ def avvideodownload(i,url,data,r,c,c3,se,ip,ud) :
736736
if 'sub' in data :
737737
for s in data['sub']:
738738
downsub(r2, filen + "." + vf, s, ip, se, data, ns, i)
739-
imgf = file.spfn(filen + "." + vf)[0] + "." + file.geturlfe(data['pic']) # 图片文件名
740-
imgs=avpicdownload(data,r,ip,se,imgf)#封面下载状况
741-
if log:
742-
logg.write(f"imgf = {imgf}\nimgs = {imgs}", currentframe(), "Normal Video Download Var13")
739+
imgs = -1
740+
if 'pic' in data:
741+
imgf = file.spfn(filen + "." + vf)[0] + "." + file.geturlfe(data['pic']) # 图片文件名
742+
imgs = avpicdownload(data,r,ip,se,imgf)#封面下载状况
743+
if log:
744+
logg.write(f"imgf = {imgf}\nimgs = {imgs}", currentframe(), "Normal Video Download Var13")
743745
if (len(durl)>1 or ma) and os.system('ffmpeg -h%s'%(getnul()))==0 and ff :
744746
print(lan['OUTPUT13'])#将用ffmpeg自动合成
745747
tt=int(time.time())
@@ -1341,10 +1343,12 @@ def avvideodownload(i,url,data,r,c,c3,se,ip,ud) :
13411343
if 'sub' in data :
13421344
for s in data['sub']:
13431345
downsub(r2, filen, s, ip, se, data, ns, i, dash['video']['width'], dash['video']['height'])
1344-
imgf=file.spfn(filen)[0]+"."+file.geturlfe(data['pic'])#图片文件名
1345-
imgs=avpicdownload(data,r,ip,se,imgf)#封面下载状况
1346-
if log:
1347-
logg.write(f"imgf = {imgf}\nimgs = {imgs}", currentframe(), "Normal Video Download Var26")
1346+
imgs = -1
1347+
if 'pic' in data:
1348+
imgf = file.spfn(filen)[0]+"."+file.geturlfe(data['pic'])#图片文件名
1349+
imgs = avpicdownload(data,r,ip,se,imgf)#封面下载状况
1350+
if log:
1351+
logg.write(f"imgf = {imgf}\nimgs = {imgs}", currentframe(), "Normal Video Download Var26")
13481352
if os.system('ffmpeg -h%s'%(getnul()))==0 and ff:
13491353
print(lan['OUTPUT13'])#将用ffmpeg自动合成
13501354
tt = int(time.time())
@@ -1634,6 +1638,8 @@ def avpicdownload(data,r:requests.Session,ip,se,fn:str=None) ->int :
16341638
-1 文件夹创建失败
16351639
-2 封面文件下载失败
16361640
-3 覆盖文件失败"""
1641+
if 'pic' not in data:
1642+
return 0
16371643
log = False
16381644
logg = None
16391645
if 'logg' in ip:
@@ -2066,12 +2072,14 @@ def avaudiodownload(data: dict, r: requests.session, i: int, ip: dict, se: dict,
20662072
else:
20672073
for s in data['sub']:
20682074
downlrc(r2, f'{filen}.m4a', s, ip, se, data, ns, i)
2069-
imgf = file.spfn(filen + ".m4a")[0] + "." + file.geturlfe(data['pic']) # 图片文件名
2070-
if log:
2071-
logg.write(f"imgf = {imgf}", currentframe(), "Normal Video Audio Download Var7")
2072-
imgs = avpicdownload(data, r, ip, se, imgf) # 封面下载状况
2073-
if log:
2074-
logg.write(f"imgs = {imgs}", currentframe(), "Normal Video Audio Download Var8")
2075+
imgs = -1
2076+
if 'pic' in data:
2077+
imgf = file.spfn(filen + ".m4a")[0] + "." + file.geturlfe(data['pic']) # 图片文件名
2078+
if log:
2079+
logg.write(f"imgf = {imgf}", currentframe(), "Normal Video Audio Download Var7")
2080+
imgs = avpicdownload(data, r, ip, se, imgf) # 封面下载状况
2081+
if log:
2082+
logg.write(f"imgs = {imgs}", currentframe(), "Normal Video Audio Download Var8")
20752083
if ffmpeg:
20762084
print(lan['CONV_M4S_TO_M4A'])
20772085
tt = int(time.time())

0 commit comments

Comments
 (0)