rain-dl / real-url-proxy-server

通过斗鱼、虎牙及Bilibili房间号直接访问直播源的代理服务器。
GNU General Public License v2.0
155 stars 39 forks source link

关于real-url-proxy-server放到docker中使用 #10

Closed trytrytogo closed 2 years ago

trytrytogo commented 2 years ago

感谢分享这么好用的工具。 由于之前路由器性能不够,现在讲real-url-proxy-server放置到python的容器(python:slim-bullseye和python:alpine)内。 其中,bilibili和虎牙都正常使用。 但是使用douyu的时候,出现异常。 解析出来为404 NOT FOUND。 容器python版本,Python 3.10.0 具体报错内容如下:

2022-03-26 12:57:51,334 - INFO: Serving HTTP on 0.0.0.0 port 7000... 2022-03-26 12:57:59,291 - INFO: provider: douyu, room: 276200, bit_rate: None 2022-03-26 12:58:00,137 - INFO: failed to extract real url 192.168.123.186 - - [26/Mar/2022 12:58:00] "GET /douyu/276200 HTTP/1.1" 404 -

在容器里单独使用douyu.py,报错内容如下:

root@37283904918d:/real-url-proxy-server# python3 douyu.py 输入斗鱼直播间号: 276200 Traceback (most recent call last): File "/real-url-proxy-server/douyu.py", line 141, in print(s.get_real_url()) File "/real-url-proxy-server/douyu.py", line 132, in get_real_url key, url = self.get_js() File "/real-url-proxy-server/douyu.py", line 73, in get_js js = execjs.compile(func_ub9) File "/usr/local/lib/python3.10/site-packages/execjs/init.py", line 61, in compile return get().compile(source, cwd) File "/usr/local/lib/python3.10/site-packages/execjs/_runtimes.py", line 21, in get return get_from_environment() or _find_available_runtime() File "/usr/local/lib/python3.10/site-packages/execjs/_runtimes.py", line 49, in _find_available_runtime raise exceptions.RuntimeUnavailableError("Could not find an available JavaScript runtime.") execjs._exceptions.RuntimeUnavailableError: Could not find an available JavaScript runtime.

对比测试: windows直接执行脚本:Python 3.9.4

2022-03-26 20:58:59,324 - INFO: provider: douyu, room: 276200, bit_rate: None 2022-03-26 20:59:01,517 - INFO: extracted url: {'900p': 'https://hlstct.douyucdn 2.cn/dyliveflv1a/276200rlrXB2EEfX_900.m3u8?txSecret=a838db267f4ead4eab004fadf8c8 8207&txTime=623f2a31&token=web-douyu-0-276200-eb70e6469530d79af16d71572114b509&d id=10000000000000000000000000001501&ver=2018061203&st=0&preview=1&pt=3&origin=tc t', '2000p': 'http://hlstct.douyucdn2.cn/dyliveflv1a/276200rlrXB2EEfX_2000.m3u8? txSecret=540164545934c9536327ae6263ecd338&txTime=623f2a33&token=h5-douyu-0-27620 0-4a812b9ab504da1c138852663586aef9&did=10000000000000000000000000001501&origin=t ct&vhost=play2'} 127.0.0.1 - - [26/Mar/2022 20:59:01] "GET /douyu/276200 HTTP/1.1" 301 -

我1台加拿大的VPS测试情况:Python 3.6.8

[root@test-ca real-url-proxy-server]# python3 real-url-proxy-server.py -p 7000 -r 300 2022-03-26 21:04:08,124 - INFO: Serving HTTP on 0.0.0.0 port 7000... 2022-03-26 21:04:21,745 - INFO: provider: douyu, room: 276200, bit_rate: None 2022-03-26 21:04:23,479 - INFO: failed to extract real url 104.129.180.49 - - [26/Mar/2022 21:04:23] "GET /douyu/276200 HTTP/1.1" 404 - 2022-03-26 21:06:55,042 - INFO: failed to extract real url 2022-03-26 21:09:26,502 - INFO: failed to extract real url 2022-03-26 21:11:58,225 - INFO: failed to extract real url

[root@test-ca real-url-proxy-server]# python3 douyu.py 输入斗鱼直播间号: 276200 Traceback (most recent call last): File "douyu.py", line 141, in print(s.get_real_url()) File "douyu.py", line 132, in get_real_url key, url = self.get_js() File "douyu.py", line 73, in get_js js = execjs.compile(func_ub9) File "/usr/local/lib/python3.6/site-packages/execjs/init.py", line 61, in compile return get().compile(source, cwd) File "/usr/local/lib/python3.6/site-packages/execjs/_runtimes.py", line 21, in get return get_from_environment() or _find_available_runtime() File "/usr/local/lib/python3.6/site-packages/execjs/_runtimes.py", line 49, in _find_available_runtime raise exceptions.RuntimeUnavailableError("Could not find an available JavaScript runtime.") execjs._exceptions.RuntimeUnavailableError: Could not find an available JavaScript runtime.

不知道能否给分析一下,谢谢。

rain-dl commented 2 years ago

斗鱼地址解析需要JavaScript引擎,你可以安装Node.js:sudo apt install nodejs。

trytrytogo commented 2 years ago

斗鱼地址解析需要JavaScript引擎,你可以安装Node.js:sudo apt install nodejs。

感谢回复。 目前在alpine内apk add nodejs,目前已正常使用,谢谢。

trytrytogo commented 2 years ago

感谢这个作品。