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

作者,MPV似乎出问题了 #40

Closed gonejack closed 8 years ago

gonejack commented 8 years ago
i@debian:~/pytools/BiliDan$ ./bilidan.py http://www.bilibili.com/video/av899574/
INFO: Loading video info...
INFO: Got video cid: 1445374
INFO: Loading video content...
INFO: Got media URLs:
      1: http://cn-jsyz4-dx.acgvideo.com/vg6/7/d6/1445374-1.flv?expires=1445665200&ssig=PsA3_NQvtOZ_tgIstdLCLQ&oi=3074389819&appkey=85eb6835b0a1034e&or=244857364&rate=0
      2: http://cn-jsyz4-dx.acgvideo.com/vg6/7/d6/1445374-2.flv?expires=1445665200&ssig=UydrL5VDyB96uibg46xhpg&oi=3074389819&appkey=85eb6835b0a1034e&or=244857364&rate=0
INFO: Determining video resolution...
http://cn-jsyz4-dx.acgvideo.com/vg6/7/d6/1445374-1.flv?expires=1445665200&ssig=PsA3_NQvtOZ_tgIstdLCLQ&oi=3074389819&appkey=85eb6835b0a1034e&or=244857364&rate=0: Input/output error
INFO: Video resolution: 0x0
ERROR: Can not get video size. Comments may be wrongly positioned.
INFO: Loading comments...
INFO: Invoking Danmaku2ASS, converting to /tmp/tmp-danmaku2ass-odazox25.ass
INFO: Launching media player...
Warning: mpv was compiled against a different version of ffmpeg than the shared
library it is linked against. This can expose subtle ABI compatibility issues
and can lead to misbehavior and crashes.
Error parsing option force-media-title (option not found)
Setting commandline option --force-media-title= failed.

Exiting... (Fatal error)
cnbeining commented 8 years ago
http://cn-jsyz4-dx.acgvideo.com/vg6/7/d6/1445374-1.flv?expires=1445665200&ssig=PsA3_NQvtOZ_tgIstdLCLQ&oi=3074389819&appkey=85eb6835b0a1034e&or=244857364&rate=0: Input/output error

你无法下载这个文件。我复测正常。

请检查网络连通性。

m13253 commented 8 years ago

请加上参数 -v -d 这样会打印更多调试信息。 请告诉我你的 mpv 版本,你可能下载的是非最新版的。

gonejack commented 8 years ago

我用you-get试了一下,出来的结果是

i@debian:~/pytools/you-get$ python3 you-get --debug http://www.bilibili.com/video/av899574/

....

urllib.error.HTTPError: HTTP Error 301: The HTTP server returned a redirect error that would lead to an infinite loop.
The last 30x error message was:
Moved Permanently
gonejack commented 8 years ago

mpv是直接apt-get install装的

i@debian:~/pytools/BiliDan$ mpv
Warning: mpv was compiled against a different version of ffmpeg than the shared
library it is linked against. This can expose subtle ABI compatibility issues
and can lead to misbehavior and crashes.
mpv 0.8.3 (C) 2000-2015 mpv/MPlayer/mplayer2 projects
 built on Tue Mar 17 06:56:30 UTC 2015
ffmpeg library versions:
   libavutil       54.20.100 (runtime 54.27.100)
   libavcodec      56.26.100 (runtime 56.41.100)
   libavformat     56.25.101 (runtime 56.36.100)
   libswscale      3.1.101
   libavfilter     5.11.102 (runtime 5.16.101)
   libswresample   1.1.100 (runtime 1.2.100)
Warning: mpv was compiled against a different version of ffmpeg than the shared
library it is linked against. This can expose subtle ABI compatibility issues
and can lead to misbehavior and crashes.

Usage:   mpv [options] [url|path/]filename

Basic options:
 --start=<time>    seek to given (percent, seconds, or hh:mm:ss) position
 --no-audio        do not play sound
 --no-video        do not play video
 --fs              fullscreen playback
 --sub-file=<file> specify subtitle file to use
 --playlist=<file> specify playlist file

 --list-options    list all mpv options
cnbeining commented 8 years ago
$ curl -v "http://cn-jsyz4-dx.acgvideo.com/vg6/7/d6/1445374-1.flv?expires=1445665200&ssig=PsA3_NQvtOZ_tgIstdLCLQ&oi=3074389819&appkey=85eb6835b0a1034e&or=244857364&rate=0"
*   Trying 58.220.29.5...
* Connected to cn-jsyz4-dx.acgvideo.com (58.220.29.5) port 80 (#0)
> GET /vg6/7/d6/1445374-1.flv?expires=1445665200&ssig=PsA3_NQvtOZ_tgIstdLCLQ&oi=3074389819&appkey=85eb6835b0a1034e&or=244857364&rate=0 HTTP/1.1
> Host: cn-jsyz4-dx.acgvideo.com
> User-Agent: curl/7.43.0
> Accept: */*
> 
< HTTP/1.1 301 Moved Permanently
< Server: Tengine
< Date: Sat, 24 Oct 2015 03:52:05 GMT
< Content-Type: text/html
< Content-Length: 278
< Location: http://cn-jsyz4-dx.acgvideo.com/58.220.29.5/vg6/7/d6/1445374-1.flv?expires=1445665200&ssig=PsA3_NQvtOZ_tgIstdLCLQ&oi=3074389819&appkey=85eb6835b0a1034e&or=244857364&rate=0
< Connection: keep-alive
< X-Cache-Usage: 8
< 
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<h1>301 Moved Permanently</h1>
<p>The requested resource has been assigned a new permanent URI.</p>
<hr/>Powered by Tengine</body>
</html>
* Connection #0 to host cn-jsyz4-dx.acgvideo.com left intact

$ curl -v "http://cn-jsyz4-dx.acgvideo.com/58.220.29.5/vg6/7/d6/1445374-1.flv?expires=1445665200&ssig=PsA3_NQvtOZ_tgIstdLCLQ&oi=3074389819&appkey=85eb6835b0a1034e&or=244857364&rate=0"
*   Trying 58.220.29.5...
* Connected to cn-jsyz4-dx.acgvideo.com (58.220.29.5) port 80 (#0)
> GET /58.220.29.5/vg6/7/d6/1445374-1.flv?expires=1445665200&ssig=PsA3_NQvtOZ_tgIstdLCLQ&oi=3074389819&appkey=85eb6835b0a1034e&or=244857364&rate=0 HTTP/1.1
> Host: cn-jsyz4-dx.acgvideo.com
> User-Agent: curl/7.43.0
> Accept: */*
> 
< HTTP/1.1 200 OK
< Date: Sat, 24 Oct 2015 03:52:20 GMT
< Content-Type: video/x-flv
< Content-Length: 42301199
< Connection: keep-alive
< Server: Tengine
< Last-Modified: Wed, 09 Sep 2015 16:55:13 GMT
< ETag: "55f06471-285770f"
< Accept-Ranges: bytes
< X-Cache: BYPASS from cn-jsyz4-dx.hdslb.com
< X-Cache-Lookup: HIT from cn-jsyz4-dx.hdslb.com Disk
< 
FLV    ?
onMetaDatcreatoryou.video.sina.com.cnmetadatacreator3Yet Another Metadata Injector for FLV - Version 1.8
                        hasKeyframehasVidehasAudio
                                                  hasMetadata
                                                             canSeekToEndurationvideodatarate@?A?????   videosizeA??x?  framerate@8Kh@d7
audiodatarate@OpK?0? videocodecid@width@?height@??  audiosizeAF??

你当地的问题,或者运营商缓存问题,或者直传服务器炸了,或者。。。(

gonejack commented 8 years ago

好像是处理不了跳转的样子:

我重复你的命令得到的是跳转:

i@debian:~$ curl -v "http://cn-jsyz4-dx.acgvideo.com/58.220.29.5/vg6/7/d6/1445374-1.flv?expires=1445665200&ssig=PsA3_NQvtOZ_tgIstdLCLQ&oi=3074389819&appkey=85eb6835b0a1034e&or=244857364&rate=0"
* Hostname was NOT found in DNS cache
*   Trying 58.220.29.5...
* Connected to cn-jsyz4-dx.acgvideo.com (58.220.29.5) port 80 (#0)
> GET /58.220.29.5/vg6/7/d6/1445374-1.flv?expires=1445665200&ssig=PsA3_NQvtOZ_tgIstdLCLQ&oi=3074389819&appkey=85eb6835b0a1034e&or=244857364&rate=0 HTTP/1.1
> User-Agent: curl/7.38.0
> Host: cn-jsyz4-dx.acgvideo.com
> Accept: */*
> 
* HTTP 1.0, assume close after body
< HTTP/1.0 302 Found
< Cache-Control: no-cache
< Connection: close
< Location: http://101.4.136.3:9999/cn-jsyz4-dx.acgvideo.com/58.220.29.5/vg6/7/d6/1445374-1.flv?expires=1445665200&ssig=PsA3_NQvtOZ_tgIstdLCLQ&oi=3074389819&appkey=85eb6835b0a1034e&or=244857364&rate=0
< 
* Closing connection 0

然后使用返回的Location再ping一次,好像返回就正常了

i@debian:~$ curl -v "http://101.4.136.3:9999/cn-jsyz4-dx.acgvideo.com/58.220.29.5/vg6/7/d6/1445374-1.flv?expires=1445665200&ssig=PsA3_NQvtOZ_tgIstdLCLQ&oi=3074389819&appkey=85eb6835b0a1034e&or=244857364&rate=0"
* Hostname was NOT found in DNS cache
*   Trying 101.4.136.3...
* Connected to 101.4.136.3 (101.4.136.3) port 9999 (#0)
> GET /cn-jsyz4-dx.acgvideo.com/58.220.29.5/vg6/7/d6/1445374-1.flv?expires=1445665200&ssig=PsA3_NQvtOZ_tgIstdLCLQ&oi=3074389819&appkey=85eb6835b0a1034e&or=244857364&rate=0 HTTP/1.1
> User-Agent: curl/7.38.0
> Host: 101.4.136.3:9999
> Accept: */*
> 
< HTTP/1.1 301 Moved Permanently
* Server Tengine is not blacklisted
< Server: Tengine
< Date: Sat, 24 Oct 2015 03:40:20 GMT
< Content-Type: text/html
< Content-Length: 278
< Location: http://cn-jsyz4-dx.acgvideo.com/58.220.29.5/vg6/7/d6/1445374-1.flv?expires=1445665200&ssig=PsA3_NQvtOZ_tgIstdLCLQ&oi=3074389819&appkey=85eb6835b0a1034e&or=244857364&rate=0
< X-Cache-Usage: 2
< Connection: keep-alive
< 
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<h1>301 Moved Permanently</h1>
<p>The requested resource has been assigned a new permanent URI.</p>
<hr/>Powered by Tengine</body>
</html>
* Connection #0 to host 101.4.136.3 left intact
cnbeining commented 8 years ago

啥也不说了 小运营商的内网缓存闹的。

救不了了。

gonejack commented 8 years ago

校园网Σ(゚д゚;)

cnbeining commented 8 years ago

image

image

m13253 commented 8 years ago

挂代理吧。 把 http_proxy 这个环境变量设置成你的代理地址就可以让 bilidan 走这个代理。

实际上是,如果你的运营商缓存有bug,用任何播放器都没法看B站视频…… :joy: