Skip to content

Commit 2a9fbf5

Browse files
authored
Merge pull request #7 from lifegpc/dev
v1.1.0 devlopment
2 parents b8860c9 + 5b8c83a commit 2a9fbf5

32 files changed

Lines changed: 1061 additions & 460 deletions

HTMLParser.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# (C) 2019-2020 lifegpc
2+
# This file is part of bili.
3+
#
4+
# This program is free software: you can redistribute it and/or modify
5+
# it under the terms of the GNU General Public License as published by
6+
# the Free Software Foundation, either version 3 of the License, or
7+
# (at your option) any later version.
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
116
from html.parser import HTMLParser
217
class Myparser(HTMLParser) :
318
"解析B站HTML"

JSONParser.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# (C) 2019-2020 lifegpc
2+
# This file is part of bili.
3+
#
4+
# This program is free software: you can redistribute it and/or modify
5+
# it under the terms of the GNU General Public License as published by
6+
# the Free Software Foundation, either version 3 of the License, or
7+
# (at your option) any later version.
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
116
from json import loads,dumps
217
from os.path import exists
318
from os import remove
@@ -150,8 +165,8 @@ def getplinfo(d:dict) :
150165
r['mtime']=t['mtime']
151166
r['count']=t['media_count']
152167
return r
153-
def getpli(r,f,i):
154-
uri='https://api.bilibili.com/x/v3/fav/resource/list?media_id=%s&pn=%s&ps=20&keyword=&order=mtime&type=0&tid=0&jsonp=jsonp'%(f,i)
168+
def getpli(r,f,i,d:dict):
169+
uri='https://api.bilibili.com/x/v3/fav/resource/list?media_id=%s&pn=%s&ps=20&keyword=%s&order=mtime&type=%s&tid=0&jsonp=jsonp'%(f,i,d['k'],d['t'])
155170
bs=True
156171
while bs :
157172
try :

PrintInfo.py

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# (C) 2019-2020 lifegpc
2+
# This file is part of bili.
3+
#
4+
# This program is free software: you can redistribute it and/or modify
5+
# it under the terms of the GNU General Public License as published by
6+
# the Free Software Foundation, either version 3 of the License, or
7+
# (at your option) any later version.
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
116
from time import localtime,strftime
217
from biliTime import tostr2
318
def printInfo(data) :
@@ -117,4 +132,25 @@ def printcho(cho) :
117132
print('你选中了',end='')
118133
for i in cho :
119134
print('%s,' %(i['titleFormat']),end='')
120-
print()
135+
print()
136+
def pr() :
137+
print(""" bili 版权所有 (C) 2019-2020 lifegpc
138+
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
139+
本程序不负任何担保责任,欲知详情请键入'show w'。
140+
This is free software, and you are welcome to redistribute it
141+
under certain conditions; type `show c' for details.
142+
这是一个自由软件,欢迎您在特定条件下再发布本程序;欲知详情请键入'show c'。
143+
You can find the source code on <https://github.com/lifegpc/bili>.
144+
你可以在<https://github.com/lifegpc/bili>上找到源代码。
145+
""")
146+
def prc() :
147+
try :
148+
f=open("LICENSE","r",encoding="utf8")
149+
t=f.readline()
150+
while t :
151+
print(t)
152+
t=f.readline()
153+
f.close()
154+
except :
155+
print("Can't find GNU GPL3 LICENSE file, please see <http://www.gnu.org/licenses/>.")
156+
print("找不到GNU GPL3 LICENSE文件,请看<http://www.gnu.org/licenses/>。")

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
## 依赖库
77
[requests](https://pypi.org/project/requests/)
88
[selenium](https://pypi.org/project/selenium/)
9-
[goto-statement](https://github.com/snoack/python-goto)
109
自己写的file库
1110
如需自动合成视频,需要当前目录内或者环境变量PATH目录内有ffmpeg。
1211
如需使用aria2下载视频,需要当前目录内或者环境变量PATH目录内有aria2c。

biliBv.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# (C) 2019-2020 lifegpc
2+
# This file is part of bili.
3+
#
4+
# This program is free software: you can redistribute it and/or modify
5+
# it under the terms of the GNU General Public License as published by
6+
# the Free Software Foundation, either version 3 of the License, or
7+
# (at your option) any later version.
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
116
table='fZodR9XQDSUm21yCkr6zBqiveYah8bt4xsWpHnJE7jL5VG3guMTKNPAwcF'
217
tr={}
318
for i in range(58):

biliDanmu.py

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# (C) 2019-2020 lifegpc
2+
# This file is part of bili.
3+
#
4+
# This program is free software: you can redistribute it and/or modify
5+
# it under the terms of the GNU General Public License as published by
6+
# the Free Software Foundation, either version 3 of the License, or
7+
# (at your option) any later version.
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
116
import biliDanmuDown
217
from os.path import exists
318
from os import mkdir,remove
@@ -10,6 +25,7 @@
1025
import biliLogin
1126
import biliDanmuAuto
1227
import file
28+
from JSONParser import getset
1329
def downloadh(filen,r,pos,da) :
1430
d=biliDanmuDown.downloadh(pos,r,biliTime.tostr(biliTime.getDate(da)))
1531
if d==-1 :
@@ -227,7 +243,7 @@ def DanmuGetn(c,data,r,t,xml,xmlc,ip) :
227243
print('保存文件失败'+filen)
228244
return -2
229245
return 0
230-
def DanmuGeta(c,data,r,t,xml,xmlc,ip) :
246+
def DanmuGeta(c,data,r,t,xml,xmlc,ip:dict,se:dict) :
231247
"全弹幕处理"
232248
try :
233249
if not exists('Download') :
@@ -244,8 +260,18 @@ def DanmuGeta(c,data,r,t,xml,xmlc,ip) :
244260
if t=='av' :
245261
bs=True
246262
at2=False
263+
fi=True
264+
jt=False
265+
if getset(se,'jt')==True :
266+
jt=True
247267
while bs :
248-
at=input('请输入两次抓取之间的天数(1-365),输入a启动自动模式(可能有点傻)')
268+
if fi and 'jt' in ip:
269+
fi=False
270+
at=ip['jt']
271+
elif jt :
272+
at='a'
273+
else:
274+
at=input('请输入两次抓取之间的天数(1-365),输入a启动自动模式(可能有点傻)')
249275
if at.isnumeric() and int(at)<=365 and int(at)>=1 :
250276
at=int(at)
251277
bs=False
@@ -563,8 +589,20 @@ def DanmuGeta(c,data,r,t,xml,xmlc,ip) :
563589
bs=True
564590
at2=False
565591
pubt=data['mediaInfo']['time'][0:10]
592+
fi=True
593+
jt=False
594+
if getset(se,'jt')==True :
595+
jt=True
596+
if 'jts' in ip :
597+
pubt=ip['jts']
566598
while bs :
567-
at=input('请输入两次抓取之间的天数(1-365),输入a启动自动模式(可能有点傻),输入b手动输入日期(当前日期:%s)' % (pubt))
599+
if fi and 'jt' in ip:
600+
fi=False
601+
at=ip['jt']
602+
elif jt :
603+
at='a'
604+
else:
605+
at=input('请输入两次抓取之间的天数(1-365),输入a启动自动模式(可能有点傻),输入b手动输入日期(当前日期:%s)' % (pubt))
568606
if at.isnumeric() and int(at)<=365 and int(at)>=1 :
569607
at=int(at)
570608
bs=False

biliDanmuAuto.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# (C) 2019-2020 lifegpc
2+
# This file is part of bili.
3+
#
4+
# This program is free software: you can redistribute it and/or modify
5+
# it under the terms of the GNU General Public License as published by
6+
# the Free Software Foundation, either version 3 of the License, or
7+
# (at your option) any later version.
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
116
import biliDanmu
217
import json
318
import biliLogin

biliDanmuCreate.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# (C) 2019-2020 lifegpc
2+
# This file is part of bili.
3+
#
4+
# This program is free software: you can redistribute it and/or modify
5+
# it under the terms of the GNU General Public License as published by
6+
# the Free Software Foundation, either version 3 of the License, or
7+
# (at your option) any later version.
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
116
import cgi
217
def objtoxml(s) :
318
try :

biliDanmuDown.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# (C) 2019-2020 lifegpc
2+
# This file is part of bili.
3+
#
4+
# This program is free software: you can redistribute it and/or modify
5+
# it under the terms of the GNU General Public License as published by
6+
# the Free Software Foundation, either version 3 of the License, or
7+
# (at your option) any later version.
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
116
def downloadn(cid,r) :
217
"下载当前弹幕"
318
try :

biliDanmuXmlFilter.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# (C) 2019-2020 lifegpc
2+
# This file is part of bili.
3+
#
4+
# This program is free software: you can redistribute it and/or modify
5+
# it under the terms of the GNU General Public License as published by
6+
# the Free Software Foundation, either version 3 of the License, or
7+
# (at your option) any later version.
8+
#
9+
# This program is distributed in the hope that it will be useful,
10+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
# GNU General Public License for more details.
13+
#
14+
# You should have received a copy of the GNU General Public License
15+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
116
from re import search
217
def Filter(s,l) :
318
"过滤弹幕"

0 commit comments

Comments
 (0)