Open pengkui opened 12 years ago
各文件头加了句
然后把那个print语句注释掉,结果:
R:\DOWNLOADS>python .\iambus\bilibili.py http://www.bilibili.tv/video/av204442/index_2.html
45%[=================== ] 3/4Traceback (most recent call last):
File ".\iambus\bilibili.py", line 74, in
貌似是第三小段下载出了问题
不少人在bilibili在线观看也有相关的感觉:如果不等整个进度条全满而开始观看的话, 视频有可能从6分钟跳跃到12分钟,或者从12分到18分……
擦……重新运行竟然错误也随机
R:\DOWNLOADS>python .\iambus\bilibili.py http://www.bilibili.tv/video/av204442/index_2.html
24%[========== ] 2/4Traceback (most recent call last):
File ".\iambus\bilibili.py", line 74, in
第一个问题不清楚,没遇到过。你的系统是什么语言的?怎么编码会是cp437? 后两个应该都是网络问题。现在没有重试和断点续传的功能。有时间可能会改进下。
英文版win7 64位。
大致看了一下,你对title做了utf-8处理,但是没有指定源代码里面字符串的编码。其实每个源文件前加一句用"# -- coding: utf-8 --"指定一下,就OK了。
我猜print 'Downloading %s.%s ...' % (title, ext) 一句里,title已经是utf-8,但ext=='flv‘不一定是,所以这种写法print有可能报错(跟OS的默认编码设置也有关)。
断点其实就不用搞了。超时重试抓异常、加个循环应该就可以。
R:\DOWNLOADS\iambus>python bilibili.py http://www.bilibili.tv/video/av204442/index_3.html Traceback (most recent call last): File "bilibili.py", line 73, in
main()
File "bilibili.py", line 70, in main
script_main('bilibili', bilibili_download)
File "R:\DOWNLOADS\iambus\common.py", line 232, in script_main
download(url)
File "bilibili.py", line 57, in bilibili_download
iask_download_by_id(id, title)
File "R:\DOWNLOADS\iambus\iask.py", line 16, in iask_download_by_id
download_urls(urls, title, 'flv', total_size=None)
File "R:\DOWNLOADS\iambus\common.py", line 188, in download_urls
print 'Downloading %s.%s ...' % (title, ext)
File "C:\Python27\lib\encodings\cp437.py", line 12, in encode
return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode characters in position 12-21: character maps to
OS: win7 64bit