m13253 / BiliDan

Play videos on Bilibili.com with MPV and Danmaku2ASS
http://m13253.blogspot.com/2014/06/watch-bilibili-with-biligrab-danmaku2ass.html
Other
513 stars 69 forks source link

HTML5 API 处理优酷失败 #14

Closed m13253 closed 9 years ago

m13253 commented 9 years ago
bilidan.py http://www.bilibili.com/video/av1731043/ --source html5 -v
DEBUG: Detected mpv version: 0.6.2
INFO: Loading video info...
DEBUG: Fetch: http://api.bilibili.com/view?sign=251d5404fef1a34a88282f3a952c183e&type=json&page=1&appkey=85eb6835b0a1034e&id=1731043
INFO: Got video cid: 2643856
INFO: This API can be slow, and is unavalable for some source like Tencent.
INFO: Found m3u8, processing...
ERROR: Type str doesn't support the buffer API

Type str doesn't support the buffer API 应该是把 Python 3 的 bytesstr 弄混了吧?

另外 INFO: This API can be slow, and is unavalable for some source like Tencent. 这里用 WARNING 等级是不是比 INFO 好呢? 总觉得这英语怪怪的,好像还拼错了一个词…… 改成 WARNING: You are using --source html5, which is an experimental feature and may be slow or unstable.

@cnbeining

cnbeining commented 9 years ago

我从不用bytes.。。。。

我的机器卡到复现不了问题,简直呵呵了。我再观察观察吧。。。。

m13253 commented 9 years ago

我开了 --debug,输出了 BackTrace,请看:

./bilidan.py http://www.bilibili.com/video/av1731043/ --source html5 --verbose --debug
DEBUG: Detected mpv version: 0.6.2
INFO: Loading video info...
DEBUG: Fetch: http://api.bilibili.com/view?appkey=85eb6835b0a1034e&id=1731043&sign=251d5404fef1a34a88282f3a952c183e&type=json&page=1
INFO: Got video cid: 2643856
INFO: This API can be slow, and is unavalable for some source like Tencent.
INFO: Found m3u8, processing...
ERROR: Type str doesn't support the buffer API
Traceback (most recent call last):
  File "/home/brilliant/work/BiliDan/bilidan.py", line 382, in <module>
    sys.exit(main())
  File "/home/brilliant/work/BiliDan/bilidan.py", line 367, in main
    retval = retval or biligrab(url, debug=args.debug, verbose=args.verbose, media=args.media, cookie=args.cookie, quality=quality, source=source, mpvflags=mpvflags, d2aflags=d2aflags)
  File "/home/brilliant/work/BiliDan/bilidan.py", line 110, in biligrab
    media_urls = find_video_address_html5(aid, pid, header=BILIGRAB_HEADER)
  File "/home/brilliant/work/BiliDan/bilidan.py", line 338, in find_video_address_html5
    return process_m3u8(raw_url)
  File "/home/brilliant/work/BiliDan/bilidan.py", line 312, in process_m3u8
    return [data[4].split('?')[0]]
TypeError: Type str doesn't support the buffer API
m13253 commented 9 years ago

我从不用bytes.。。。。

:arrow_up: :arrow_up: 果然是概念上就弄混了呢……

cnbeining commented 9 years ago

必须混淆了。

我先去弄个side project。

这个api不要指望了,我这边的反馈很悲观。 On Sat, Nov 22, 2014 at 5:26 PM Star Brilliant notifications@github.com wrote:

我从不用bytes.。。。。 [image: :arrow_up:] [image: :arrow_up:] 果然是概念上就弄混了呢……

— Reply to this email directly or view it on GitHub https://github.com/m13253/BiliDan/issues/14#issuecomment-64074514.

m13253 commented 9 years ago

我这头正在重构。改了一大堆东西。新 API 有什么问题呢?具体说一说吧?

顺便,你的 Chrome 好了没?

cnbeining commented 9 years ago

Biligrab暂时差不是很多了,我觉得。

除非有其他构想,否则下一个有可能加个下载某人所有东西,但是没有别的了。

还有对Biligrab的建议吗?

API的问题是,这东西就不响应。而且一直返回error。然后还能有啥然后。。。。

Chrome是10.10.2的冲突问题,没法修。而且Chrome也不打算出新版,认为这是Apple的BUG。那就只有用户可怜了。。。我看看能不能强行回10.10.1吧。

m13253 commented 9 years ago

API的问题是,这东西就不响应。而且一直返回error。然后还能有啥然后。。。。

那 m.acg.tv 网页端是怎么解析的?

cnbeining commented 9 years ago

这孙子九成九失效。

没招了(╯‵□′)╯︵┻━┻

在 14/11/23 上午10:56, Star Brilliant 写道:

API的问题是,这东西就不响应。而且一直返回error。然后还能有啥然
后。。。。

那 m.acg.tv 网页端是怎么解析的?

— Reply to this email directly or view it on GitHub https://github.com/m13253/BiliDan/issues/14#issuecomment-64104670.

m13253 commented 9 years ago

还有对Biligrab的建议吗?

做一个 API 接口可以让别的 Python 模块调用呗?如果有精力的话。

cnbeining commented 9 years ago

我是都拆成函数了。各取所需。。。

我在这几个版本尽可能动手砍耦合性,基本上函数们都可以自己跑。当然,需要很多helper functions。

当然这是之后的事情了。。。

在 2014年11月23日,下午2:42,Star Brilliant notifications@github.com 写道:

还有对Biligrab的建议吗?

做一个 API 接口可以让别的 Python 模块调用呗?如果有精力的话。

— Reply to this email directly or view it on GitHub https://github.com/m13253/BiliDan/issues/14#issuecomment-64108669.

m13253 commented 9 years ago

等上游更新。先close。

m13253 commented 9 years ago

fixed in commit 2875f61a23381ff04d11495cddddfcae77a71d5c 用五行代码重写了整个 HTML5 视频源解析。现在可以用了。

(有的时候网络不好需要低清视频源的时候似乎很有用呢。)