Closed zizhengwu closed 2 years ago
我这里可以播放,会不会是偶发网络故障?参数可以使用 -h
获取,--debug
可以打印详细信息。
谢谢,感觉好像是 macOS 自带 Python 的问题,我试试装一个 homebrew 的 Python。
~/git/ykdl master ?3 ───────────────────────────────────────────────── 22:09:24
❯ ykdl https://www.douyu.com/danche --debug -p mpv
DEBUG:ykdl.util.http:Add <urllib.request.ProxyHandler object at 0x10b3bc430> to default handlers
DEBUG:ykdl.common:host> www.douyu.com
DEBUG:ykdl.common:short_name> douyu
DEBUG:ykdl.util.http:get_response> URL: https://www.douyu.com/danche
DEBUG:ykdl.util.http:Redirect to URL: https://www.douyu.com/339610
DEBUG:ykdl.util.http:Redirect to URL: https://www.douyu.com/topic/DOTA2-DJCS?rid=339610
DEBUG:YKDL:Expecting value: line 1 column 1 (char 0):
Traceback (most recent call last):
File "/Users/zizhengwu/git/ykdl/lib/python3.8/site-packages/jsengine/external.py", line 81, in _eval
_, ok, result = json.loads(result_line)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/json/__init__.py", line 357, in loads
return _default_decoder.decode(s)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/zizhengwu/git/ykdl/lib/python3.8/site-packages/cykdl/__main__.py", line 290, in main
info = parser(u)
File "/Users/zizhengwu/git/ykdl/lib/python3.8/site-packages/ykdl/extractor.py", line 36, in parser
info = self.prepare()
File "/Users/zizhengwu/git/ykdl/lib/python3.8/site-packages/ykdl/extractors/douyu/live.py", line 56, in prepare
ub98484234(js_enc, self, params)
File "/Users/zizhengwu/git/ykdl/lib/python3.8/site-packages/ykdl/extractors/douyu/util.py", line 80, in ub98484234
ub98484234 = js_ctx.call('ub98484234', extractor.vid, did, tt)
File "/Users/zizhengwu/git/ykdl/lib/python3.8/site-packages/jsengine/util.py", line 59, in newfunc
return func(self, *args, **kwargs)
File "/Users/zizhengwu/git/ykdl/lib/python3.8/site-packages/jsengine/abstract.py", line 104, in call
return self.eval(code)
File "/Users/zizhengwu/git/ykdl/lib/python3.8/site-packages/jsengine/util.py", line 59, in newfunc
return func(self, *args, **kwargs)
File "/Users/zizhengwu/git/ykdl/lib/python3.8/site-packages/jsengine/abstract.py", line 95, in eval
return self._eval(code)
File "/Users/zizhengwu/git/ykdl/lib/python3.8/site-packages/jsengine/external.py", line 84, in _eval
raise RuntimeError('%s:\n%s' % (e, output))
jsengine.exceptions.RuntimeError: Expecting value: line 1 column 1 (char 0):
从错误信息看好像是 jsengine 调用没匹配好,但我没有 macOS 来测试,也没看得其他人报斗鱼失败。
你最后几行错误信息是不是没有贴完?
你最后几行错误信息是不是没有贴完?
测试了下,贴完了,确实有点奇怪戛然而止。另外我的版本是 macOS 12.3。我还在装一个 homebrew 的 Python试试。
是不是 jsc 又更新位置?你看看下面两个位置是否存在?
/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Resources/jsc
/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Helpers/jsc
下面一个 jsc 是存在的。
/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Helpers/jsc
试了下最新的 Python,好像是同样的错误
~/git/ykdl master ?3 ─────────────────────────────────────────────────────────────────────────────────────────── ykdl 23:10:51
❯ ykdl https://www.douyu.com/danche --debug -p mpv
DEBUG:ykdl.util.http:Add <urllib.request.ProxyHandler object at 0x10b743eb0> to default handlers
DEBUG:ykdl.common:host> www.douyu.com
DEBUG:ykdl.common:short_name> douyu
DEBUG:ykdl.util.http:get_response> URL: https://www.douyu.com/danche
DEBUG:ykdl.util.http:Redirect to URL: https://www.douyu.com/339610
DEBUG:ykdl.util.http:Redirect to URL: https://www.douyu.com/topic/DOTA2-DJCS?rid=339610
DEBUG:YKDL:Expecting value: line 1 column 1 (char 0):
Traceback (most recent call last):
File "/Users/zizhengwu/git/ykdl/lib/python3.10/site-packages/jsengine/external.py", line 81, in _eval
_, ok, result = json.loads(result_line)
File "/Users/zizhengwu/.pyenv/versions/3.10.3/lib/python3.10/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/Users/zizhengwu/.pyenv/versions/3.10.3/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Users/zizhengwu/.pyenv/versions/3.10.3/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/zizhengwu/git/ykdl/lib/python3.10/site-packages/cykdl/__main__.py", line 290, in main
info = parser(u)
File "/Users/zizhengwu/git/ykdl/lib/python3.10/site-packages/ykdl/extractor.py", line 36, in parser
info = self.prepare()
File "/Users/zizhengwu/git/ykdl/lib/python3.10/site-packages/ykdl/extractors/douyu/live.py", line 56, in prepare
ub98484234(js_enc, self, params)
File "/Users/zizhengwu/git/ykdl/lib/python3.10/site-packages/ykdl/extractors/douyu/util.py", line 80, in ub98484234
ub98484234 = js_ctx.call('ub98484234', extractor.vid, did, tt)
File "/Users/zizhengwu/git/ykdl/lib/python3.10/site-packages/jsengine/util.py", line 59, in newfunc
return func(self, *args, **kwargs)
File "/Users/zizhengwu/git/ykdl/lib/python3.10/site-packages/jsengine/abstract.py", line 104, in call
return self.eval(code)
File "/Users/zizhengwu/git/ykdl/lib/python3.10/site-packages/jsengine/util.py", line 59, in newfunc
return func(self, *args, **kwargs)
File "/Users/zizhengwu/git/ykdl/lib/python3.10/site-packages/jsengine/abstract.py", line 95, in eval
return self._eval(code)
File "/Users/zizhengwu/git/ykdl/lib/python3.10/site-packages/jsengine/external.py", line 84, in _eval
raise RuntimeError('%s:\n%s' % (e, output))
jsengine.exceptions.RuntimeError: Expecting value: line 1 column 1 (char 0):
另外我用的是 Apple silicon 的 Mac,不确定这是不是有关系。
最后 jsc 输出是空白,有点怪。下面的命令能打印信息吗?
/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Helpers/jsc --help
/System/Library/Frameworks/JavaScriptCore.framework/Versions/A/Helpers/jsc --help
应该是存在的
同意最后 jsc 输出是空白,有点怪
你安装这个看看是否修复成功。 jsengine-1.0.5.tar.gz
这个 bug 很久都没发现,看来没有多少人安装测试版。 这段时间没什么心思改代码,干脆这几天发个正式版算了,之后再慢慢改。
谢谢,用pip3 install https://github.com/SeaHOH/jsengine/archive/refs/heads/master.zip
,斗鱼可以正常播放了。
安装使用的是 master c6cedf9 版本,macOS Python 3.8.9。日志如下:
非常奇怪,命令直接就结束返回了,好像没返回 0,请告知我如何找到更详细的日志。相比之下,我试过 huya,bilibili 之类,都能正常使用(
ykdl https://live.bilibili.com/888 -p mpv
)