【Python】爬取B站视频 GUI Edition
本帖最后由 qiuyouzhi 于 2021-2-8 16:27 编辑爬取B站视频 GUI Edition
使用的第三方库:
requests - 爬取 B 站 API 接口
easygui - 一些小功能,比如选择下载日志的保存位置等。
danmaku2ass - 把格式为 .xml 的弹幕文件转换为 .ass 字幕文件
链接:https://github.com/m13253/danmaku2ass
界面:
使用教程:
1,设置下载参数
运行main.py,点击 菜单 - 文件 - 下载选项设置
在第一栏中输入 BV 或者 AV 号,其他的都可以不输。
默认为不下载弹幕,若需要,请在对应栏输入 Y / y 。
最末一栏是下载位置,默认为代码所在目录的 Video 文件夹(若没有会自动进行创建)
设置完成后,点击左下方的 "完成" 按钮,完成设置。
2,正式下载视频
基本的参数已经设置好了,接下来只需要点击左下方的 "运行" 按钮运行程序即可。
左半部分的 Text 组件是日志,会显示下载进行程度。
右半部分则是视频和视频作者的信息。我认为需要显示的就这么多,如果有需要各位可以提下意见。
视频会保存到你指定的保存位置去。
3,播放带弹幕的视频
首先播放视频。
随后,将字幕文件(名称为 {视频名称}.ass)拖入播放器窗口,即可播放视频。
效果:
代码下载:
Update:
修复下载BUG,优化用户体验
**** Hidden Message ***** @不二如是 申精~
{:5_108:} 赞~!
GUI 介意加一个作者署名吗{:10_256:} 不二如是 发表于 2021-2-7 11:41
GUI 介意加一个作者署名吗
没问题鸭{:10_256:} 不二如是 发表于 2021-2-7 11:41
GUI 介意加一个作者署名吗
加好了,您帮忙看一下对不对呗 1 {:5_105:} 学习 1 学习学习 好家伙 学习一下,谢谢up GlacierGao 发表于 2021-2-9 17:03
学习一下,谢谢up
我不是up.. 牛牛牛{:10_297:} 输入BV号点运行没效果 报错:
Exception in thread Thread-2:
Traceback (most recent call last):
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\lenovo\Desktop\B站视频下载器\main.py", line 74, in main
aid = self.DBV.BV_to_AV(BV)
File "C:\Users\lenovo\Desktop\B站视频下载器\get_video.py", line 38, in BV_to_AV
bv *= 58
IndexError: list index out of range
Exception in thread Thread-3:
Traceback (most recent call last):
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\lenovo\Desktop\B站视频下载器\main.py", line 74, in main
aid = self.DBV.BV_to_AV(BV)
File "C:\Users\lenovo\Desktop\B站视频下载器\get_video.py", line 38, in BV_to_AV
bv *= 58
IndexError: list index out of range
Exception in thread Thread-4:
Traceback (most recent call last):
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\lenovo\Desktop\B站视频下载器\main.py", line 74, in main
aid = self.DBV.BV_to_AV(BV)
File "C:\Users\lenovo\Desktop\B站视频下载器\get_video.py", line 38, in BV_to_AV
bv *= 58
IndexError: list index out of range
Exception in thread Thread-5:
Traceback (most recent call last):
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\lenovo\Desktop\B站视频下载器\main.py", line 74, in main
aid = self.DBV.BV_to_AV(BV)
File "C:\Users\lenovo\Desktop\B站视频下载器\get_video.py", line 38, in BV_to_AV
bv *= 58
IndexError: list index out of range
Exception in thread Thread-6:
Traceback (most recent call last):
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\lenovo\Desktop\B站视频下载器\main.py", line 74, in main
aid = self.DBV.BV_to_AV(BV)
File "C:\Users\lenovo\Desktop\B站视频下载器\get_video.py", line 38, in BV_to_AV
bv *= 58
IndexError: list index out of range
Exception in thread Thread-7:
Traceback (most recent call last):
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\lenovo\Desktop\B站视频下载器\main.py", line 74, in main
Exception in thread Thread-8aid = self.DBV.BV_to_AV(BV):
Traceback (most recent call last):
File "C:\Users\lenovo\Desktop\B站视频下载器\get_video.py", line 38, in BV_to_AV
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
bv *= 58self.run()
IndexErrorFile "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run
: list index out of rangeself._target(*self._args, **self._kwargs)
File "C:\Users\lenovo\Desktop\B站视频下载器\main.py", line 74, in main
aid = self.DBV.BV_to_AV(BV)
Exception in thread File "C:\Users\lenovo\Desktop\B站视频下载器\get_video.py", line 38, in BV_to_AV
Thread-9 :
bv *= 58Traceback (most recent call last):
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
IndexError : self.run()list index out of range
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\lenovo\Desktop\B站视频下载器\main.py", line 74, in main
aid = self.DBV.BV_to_AV(BV)
File "C:\Users\lenovo\Desktop\B站视频下载器\get_video.py", line 38, in BV_to_AV
bv *= 58
IndexError: list index out of range
Exception in thread Thread-10:
Traceback (most recent call last):
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\lenovo\Desktop\B站视频下载器\main.py", line 74, in main
aid = self.DBV.BV_to_AV(BV)
File "C:\Users\lenovo\Desktop\B站视频下载器\get_video.py", line 38, in BV_to_AV
bv *= 58
IndexError: list index out of range
Exception in thread Thread-11:
Traceback (most recent call last):
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\lenovo\Desktop\B站视频下载器\main.py", line 74, in main
aid = self.DBV.BV_to_AV(BV)
File "C:\Users\lenovo\Desktop\B站视频下载器\get_video.py", line 38, in BV_to_AV
bv *= 58
IndexError: list index out of range
Exception in thread Thread-12:
Traceback (most recent call last):
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\lenovo\Desktop\B站视频下载器\main.py", line 74, in main
aid = self.DBV.BV_to_AV(BV)
File "C:\Users\lenovo\Desktop\B站视频下载器\get_video.py", line 38, in BV_to_AV
bv *= 58
IndexError: list index out of range
Exception in thread Thread-13:
Traceback (most recent call last):
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\lenovo\Desktop\B站视频下载器\main.py", line 74, in main
aid = self.DBV.BV_to_AV(BV)
File "C:\Users\lenovo\Desktop\B站视频下载器\get_video.py", line 38, in BV_to_AV
bv *= 58
IndexError: list index out of range
Exception in thread Thread-14:
Traceback (most recent call last):
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 932, in _bootstrap_inner
self.run()
File "C:\Users\lenovo\AppData\Local\Programs\Python\Python38\lib\threading.py", line 870, in run
self._target(*self._args, **self._kwargs)
File "C:\Users\lenovo\Desktop\B站视频下载器\main.py", line 74, in main
aid = self.DBV.BV_to_AV(BV)
File "C:\Users\lenovo\Desktop\B站视频下载器\get_video.py", line 38, in BV_to_AV
bv *= 58
IndexError: list index out of range 嘉岳呀 发表于 2021-2-9 19:59
输入BV号点运行没效果
是不是报错了?
截图看下 qiuyouzhi 发表于 2021-2-9 20:10
是不是报错了?
截图看下
报错正在审核 嘉岳呀 发表于 2021-2-9 20:27
报错正在审核
?