Skip to content

Commit 7406a25

Browse files
authored
Merge pull request #21 from lifegpc/dev
v1.2.0 dev
2 parents 06cf991 + 0da26a7 commit 7406a25

21 files changed

Lines changed: 684 additions & 129 deletions

JSONParser.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
from os.path import exists
1818
from os import remove
1919
from requests import Session
20+
from biliBv import enbv
21+
import sys
22+
from biliTime import tostr2
2023
def Myparser(s) :
2124
"解析普通AV视频信息"
2225
obj=loads(s)
@@ -30,6 +33,7 @@ def Myparser(s) :
3033
data['desc']=obj['videoData']['desc']
3134
data['uid']=obj['videoData']['owner']['mid']
3235
data['name']=obj['videoData']['owner']['name']
36+
data['pic']=obj['videoData']['pic']
3337
page=[]
3438
for i in obj['videoData']['pages'] :
3539
t={}
@@ -54,6 +58,10 @@ def Myparser2(s) :
5458
mediaInfo['evaluate']=obj['mediaInfo']['evaluate']
5559
mediaInfo['type']=obj['mediaInfo']['ssTypeFormat']['name']
5660
mediaInfo['time']=obj['mediaInfo']['pub']['time']
61+
t=obj['mediaInfo']['cover']
62+
if t.startswith('//'):
63+
t="https:"+t
64+
mediaInfo['cover']=t
5765
data['mediaInfo']=mediaInfo
5866
if 'epList' in obj :
5967
epList=[]
@@ -67,6 +75,10 @@ def Myparser2(s) :
6775
t['longTitle']=i['longTitle']
6876
t['i']=i['i']
6977
t['loaded']=i['loaded']
78+
p=i['cover']
79+
if str(p).startswith('//'):
80+
p="https:"+p
81+
t['cover']=p
7082
epList.append(t)
7183
data['epList']=epList
7284
if 'sections' in obj :
@@ -88,6 +100,10 @@ def Myparser2(s) :
88100
t2['i']=j['i']
89101
t2['loaded']=j['loaded']
90102
t2['title']=i['title']
103+
p=j['cover']
104+
if str(p).startswith('//'):
105+
p="https:"+p
106+
t2['cover']=p
91107
epList.append(t2)
92108
t['epList']=epList
93109
sections.append(t)
@@ -153,3 +169,44 @@ def getset(d:dict,key:str) :
153169
return d[key]
154170
else :
155171
return None
172+
def parseche(d:dict) :
173+
"解析下载课程"
174+
r={}
175+
r['che']=True #标识为下载课程
176+
t=d['data']
177+
m={}
178+
m['id']=t['season_id']
179+
m['ssId']=t['season_id']
180+
m['title']=t['title']
181+
m['jpTitle']=''
182+
m['series']=t['title']
183+
m['alias']=''
184+
m['evaluate']=t['subtitle']
185+
m['type']=''
186+
m['cover']=t['cover']
187+
e=[]
188+
b=sys.maxsize #最早的时间
189+
for i in t['episodes'] :
190+
a={}
191+
a['id']=i['id']
192+
a['aid']=i['aid']
193+
a['bvid']=enbv(int(i['aid']))
194+
a['cid']=i['cid']
195+
a['titleFormat']=f"P{i['index']}"
196+
a['longTitle']=i['title']
197+
a['i']=i['index']-1
198+
a['time']=i['release_date']
199+
if a['time']<b:
200+
b=a['time']
201+
e.append(a)
202+
m['time']=tostr2(b)
203+
r['mediaInfo']=m
204+
r['epList']=e
205+
if 'brief' in t:
206+
c=[]
207+
for i in t['brief']['img'] :
208+
c.append(i['url'])
209+
r['brief']=c
210+
if 'user_status' in t and 'progress' in t['user_status'] :
211+
r['led']=t['user_status']['progress']['last_ep_id']
212+
return r

JSONParser2.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,3 +226,33 @@ def getlr3(d:dict,r:dict):
226226
r['name']=t['name']
227227
r['sex']=t['sex']
228228
r['sign']=t['sign']
229+
def getchel(r:Session) -> list:
230+
"""获得已购课程列表
231+
-1 获取出错"""
232+
re=r.get("https://api.bilibili.com/pugv/pay/web/my/paid?ps=10&pn=1")
233+
re.encoding='utf8'
234+
re=re.json()
235+
if re['code']!=0:
236+
print(f"{re['code']} {re['message']}")
237+
return -1
238+
re=re['data']
239+
n=re['total']
240+
l:list=re['data']
241+
i=2
242+
while i<=n :
243+
bs=True
244+
while bs:
245+
try :
246+
re=r.get(f"https://api.bilibili.com/pugv/pay/web/my/paid?ps=10&pn={i}")
247+
bs=False
248+
except :
249+
print(lan['OUTPUT3'].replace('<number>',str(i)))#获取第%s页失败,正在重试……
250+
re.encoding='utf8'
251+
re=re.json()
252+
if re['code']!=0:
253+
print(f"{re['code']} {re['message']}")
254+
return -1
255+
for j in re['data']['data'] :
256+
l.append(j)
257+
i=i+1
258+
return l

Language/bili.command.ja.po

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ msgctxt "O5"
3939
msgid ""
4040
"Download method: 1.barrage 2.all barrage from historical records 3.video "
4141
"4.barrage and video 5.all barrage from historical records and video "
42-
"6.subtitles only"
42+
"6.subtitles only 7.cover image only"
4343
msgstr ""
44-
"ダウンロード方法。\n"
45-
"1.弾幕 2.過去の履歴からの全弾幕 3.ビデオ 4.弾幕とビデオ 5.ビデオと過去の履歴からの全弾幕 6.字幕のみ"
44+
"ダウンロード方法 1.弾幕 2.過去の履歴からの全ての弾幕 3.ビデオ 4.ビデオと弾幕 5.ビデオと過去の履歴からの全ての弾幕 6.字幕のみ "
45+
"7.カバー画像のみ"
4646

4747
msgctxt "O6"
4848
msgid "Live record download method: 1.video 2.barrage 3.video and barrage"
@@ -335,3 +335,11 @@ msgid ""
335335
msgstr ""
336336
"追伸4。お気に入り、チャンネル、アップロードした動画のリンクを入力すると、 \"-i <input>\"\"-p <number>\" "
337337
"のパラメータ以外にも、動画のダウンロード中に他のパラメータが使用されます。"
338+
339+
msgctxt "O60"
340+
msgid "Keep cover images when deleting useless files after merging."
341+
msgstr "マージ後に無駄なファイルを削除する際にカバー画像を保持する。"
342+
343+
msgctxt "O61"
344+
msgid "Do not keep cover images when deleting useless files after merging."
345+
msgstr "マージ後に無駄なファイルを削除する際にカバー画像を残さないようにする。"

Language/bili.command.pot

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ msgid "AV/SS/EP/MD/BV number or link"
3232
msgstr ""
3333

3434
msgctxt "O5"
35-
msgid "Download method: 1.barrage 2.all barrage from historical records 3.video 4.barrage and video 5.all barrage from historical records and video 6.subtitles only"
35+
msgid "Download method: 1.barrage 2.all barrage from historical records 3.video 4.barrage and video 5.all barrage from historical records and video 6.subtitles only 7.cover image only"
3636
msgstr ""
3737

3838
msgctxt "O6"
@@ -254,3 +254,11 @@ msgstr ""
254254
msgctxt "O59"
255255
msgid "PS4. When you input Favorites, Channels, Uploaded Video links, in addition to the \"-i <input>\" and \"-p <number>\" parameters, other parameters will be used while downloading video."
256256
msgstr ""
257+
258+
msgctxt "O60"
259+
msgid "Keep cover images when deleting useless files after merging."
260+
msgstr ""
261+
262+
msgctxt "O61"
263+
msgid "Do not keep cover images when deleting useless files after merging."
264+
msgstr ""

Language/bili.command.zh_CN.po

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ msgctxt "O5"
3939
msgid ""
4040
"Download method: 1.barrage 2.all barrage from historical records 3.video "
4141
"4.barrage and video 5.all barrage from historical records and video "
42-
"6.subtitles only"
43-
msgstr "下载方式:1.当前弹幕 2.全弹幕 3.视频 4.当前弹幕+视频 5.全弹幕+视频 6.仅字幕"
42+
"6.subtitles only 7.cover image only"
43+
msgstr "下载方式:1.当前弹幕 2.全弹幕 3.视频 4.当前弹幕+视频 5.全弹幕+视频 6.仅字幕 7.仅封面图片"
4444

4545
msgctxt "O6"
4646
msgid "Live record download method: 1.video 2.barrage 3.video and barrage"
@@ -314,3 +314,11 @@ msgid ""
314314
"to the \"-i <input>\" and \"-p <number>\" parameters, other parameters will "
315315
"be used while downloading video."
316316
msgstr "注4:当输入收藏夹/频道/投稿链接时,除了\"-i <input>\"\"-p <number>\"参数外,其他参数会在下载视频时使用"
317+
318+
msgctxt "O60"
319+
msgid "Keep cover images when deleting useless files after merging."
320+
msgstr "合并完成后删除无用文件时保留封面图片"
321+
322+
msgctxt "O61"
323+
msgid "Do not keep cover images when deleting useless files after merging."
324+
msgstr "合并完成后删除无用文件时删除封面图片"

Language/bili.setsettings.ja.po

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,3 +215,8 @@ msgid ""
215215
"Do you want to convert HTML to normal text while writing description of live"
216216
" record into file metadata?"
217217
msgstr "ライブレコードの説明文をファイルのメタデータに書きながら、HTMLを通常のテキストに変換したいですか?"
218+
219+
msgctxt "INPUT30"
220+
msgid ""
221+
"Do you want to keep cover images when deleting useless files after merging?"
222+
msgstr "マージ後に無駄なファイルを削除するときにカバー画像を残しておきますか?"

Language/bili.setsettings.pot

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,7 @@ msgstr ""
166166
msgctxt "INPUT29"
167167
msgid "Do you want to convert HTML to normal text while writing description of live record into file metadata?"
168168
msgstr ""
169+
170+
msgctxt "INPUT30"
171+
msgid "Do you want to keep cover images when deleting useless files after merging?"
172+
msgstr ""

Language/bili.setsettings.zh_CN.po

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,3 +206,8 @@ msgid ""
206206
"Do you want to convert HTML to normal text while writing description of live"
207207
" record into file metadata?"
208208
msgstr "直播回放简介写入元数据时是否将HTML转换为普通文本?"
209+
210+
msgctxt "INPUT30"
211+
msgid ""
212+
"Do you want to keep cover images when deleting useless files after merging?"
213+
msgstr "合并完成后删除无用文件时是否保留封面图片?"

Language/bili.start.ja.po

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ msgctxt "INPUT1"
2929
msgid ""
3030
"Please enter the av/ss/ep/md/bv number (bv number needs start with BV) or "
3131
"link (Support Favorites, Channels, Uploaded Video and Small Video page from "
32-
"user page. Also support live records video link.):"
32+
"user page. Also support live records video and purchased courses' video "
33+
"link.):"
3334
msgstr ""
34-
"動画番号 "
35-
"av/ss/ep/md/bv(bv番号はBVで始まる必要があります)またはURLリンクを入力してください(ユーザーページからお気に入り、チャンネル、アップロードされたビデオと小さなビデオページをサポートしています。また、ライブレコードの動画リンクにも対応しています。)"
35+
"av/ss/ep/md/bv番号(bv番号はbvで始まる必要があります)またはリンクを入力してください(ユーザーページからお気に入り、チャンネル、アップロードされたビデオと小さなビデオページをサポートしています。また、ライブ記録動画や購入したコースの動画リンクにも対応しています)"
3636

3737
msgctxt "ERROR1"
3838
msgid "Please use \"-i <input>\"."
@@ -174,15 +174,17 @@ msgid ""
174174
"3.download video\n"
175175
"4.download barrage and video\n"
176176
"5.download all barrage from historical records and video\n"
177-
"6.download subtitles only"
177+
"6.download subtitles only\n"
178+
"7.download cover image only"
178179
msgstr ""
179-
"ダウンロード方法を選択するには \".\" の前に数字を入力してください:\n"
180+
"ダウンロード方法を選択するには \".\" の前に数字を入力してください\n"
180181
"1.弾幕をダウンロードする\n"
181182
"2.過去の履歴から全ての弾幕をダウンロードする(多分、めっちゃ時間かかるで)\n"
182183
"3.動画をダウンロードする\n"
183184
"4.動画と弾幕をダウンロードする\n"
184185
"5.動画と過去の履歴から全ての弾幕をダウンロードする\n"
185-
"6.字幕のみダウンロードする"
186+
"6.字幕のみダウンロードする\n"
187+
"7.カバー画像のみををダウンロードする"
186188

187189
msgctxt "OUTPUT9"
188190
msgid "Part <number> download complete."
@@ -210,14 +212,16 @@ msgid ""
210212
"2.download all barrage from historical records (may needs lots of time)\n"
211213
"3.download video\n"
212214
"4.download barrage and video\n"
213-
"5.download all barrage from historical records and video"
215+
"5.download all barrage from historical records and video\n"
216+
"7.download cover image only"
214217
msgstr ""
215218
"ダウンロード方法を選択するには \".\" の前に数字を入力してください:\n"
216219
"1.弾幕をダウンロードする\n"
217220
"2.過去の履歴から全ての弾幕をダウンロードする(多分、めっちゃ時間かかるで)\n"
218221
"3.動画をダウンロードする\n"
219222
"4.動画と弾幕をダウンロードする\n"
220-
"5.動画と過去の履歴から全ての弾幕をダウンロードする"
223+
"5.動画と過去の履歴から全ての弾幕をダウンロードする\n"
224+
"7.カバー画像のみダウンロードする"
221225

222226
msgctxt "OUTPUT10"
223227
msgid "<title> download complete."
@@ -226,3 +230,7 @@ msgstr "<title> ダウンロードが完了しました。 "
226230
msgctxt "OUTPUT11"
227231
msgid "Please run \"start.py\"."
228232
msgstr "\"start.py\" を実行してください。"
233+
234+
msgctxt "OUTPUT12"
235+
msgid "Try to redirect to \"<link>\"."
236+
msgstr "\"<link>\" にリダイレクトしてみてください。"

Language/bili.start.pot

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ msgid "It is recommended to setup program by runing \"settings.py\" in order to
2020
msgstr ""
2121

2222
msgctxt "INPUT1"
23-
msgid "Please enter the av/ss/ep/md/bv number (bv number needs start with BV) or link (Support Favorites, Channels, Uploaded Video and Small Video page from user page. Also support live records video link.):"
23+
msgid "Please enter the av/ss/ep/md/bv number (bv number needs start with BV) or link (Support Favorites, Channels, Uploaded Video and Small Video page from user page. Also support live records video and purchased courses' video link.):"
2424
msgstr ""
2525

2626
msgctxt "ERROR1"
@@ -132,7 +132,7 @@ msgid "Do you want download with maximum quality (this will not ask for specific
132132
msgstr ""
133133

134134
msgctxt "INPUT9"
135-
msgid "Please input the number before \".\" to choose download method:\n1.download barrage\n2.download all barrage from historical records (may needs lots of time)\n3.download video\n4.download barrage and video\n5.download all barrage from historical records and video\n6.download subtitles only"
135+
msgid "Please input the number before \".\" to choose download method:\n1.download barrage\n2.download all barrage from historical records (may needs lots of time)\n3.download video\n4.download barrage and video\n5.download all barrage from historical records and video\n6.download subtitles only\n7.download cover image only"
136136
msgstr ""
137137

138138
msgctxt "OUTPUT9"
@@ -152,7 +152,7 @@ msgid "If you want to download the last viewed \"EP<number>\", please enter \"l\
152152
msgstr ""
153153

154154
msgctxt "INPUT12"
155-
msgid "Please input the number before \".\" to choose download method:\n1.download barrage\n2.download all barrage from historical records (may needs lots of time)\n3.download video\n4.download barrage and video\n5.download all barrage from historical records and video"
155+
msgid "Please input the number before \".\" to choose download method:\n1.download barrage\n2.download all barrage from historical records (may needs lots of time)\n3.download video\n4.download barrage and video\n5.download all barrage from historical records and video\n7.download cover image only"
156156
msgstr ""
157157

158158
msgctxt "OUTPUT10"
@@ -162,3 +162,7 @@ msgstr ""
162162
msgctxt "OUTPUT11"
163163
msgid "Please run \"start.py\"."
164164
msgstr ""
165+
166+
msgctxt "OUTPUT12"
167+
msgid "Try to redirect to \"<link>\"."
168+
msgstr ""

0 commit comments

Comments
 (0)