davidkingzyb / pccold

douyu斗鱼 自动化工具 主播上线通知 & 直播视频自动录制 & 弹幕抓取
MIT License
191 stars 29 forks source link

Streamlink return code 1 #18

Closed lawye closed 4 years ago

lawye commented 4 years ago

douyutv.py 复制到了/usr/local/lib/python3.5/streamlink/plugins/下

这是日志

02/19 21:35:17 [line:36] INFO $ streamlink -o "/root/douyu/download/QQ飞车_排位拉力_02_19_21_35.mp4" https://www.douyu.com/6042411 best
02/19 21:35:17 [line:89] INFO sleepKiller
02/19 21:35:17 [line:60] INFO returnCodeObserver
02/19 21:35:19 [line:65] INFO save quit pid=15172 return code=1

直接运行日志中命令出现

[cli][info] streamlink is running as root! Be careful!
[cli][info] Found matching plugin douyutv for URL https://www.douyu.com/6042411
error: Unable to open URL: https://capi.douyucdn.cn/api/v1/room/6042411?aid=androidhd1&cdn=ws&client_sys=android&time=1582119480&auth=e823db04903640973459a003bd66798c (401 Client Error: Unauthorized for url: https://capi.douyucdn.cn/api/v1/room/6042411?aid=androidhd1&cdn=ws&client_sys=android&time=1582119480&auth=e823db04903640973459a003bd66798c)
davidkingzyb commented 4 years ago

你应该没有替换掉正确的文件,全局搜一下douyutv.py

lawye commented 4 years ago

替换了所有的douyutv.py, 使用pip和apt重装了streamlink, 依然没有解决

davidkingzyb commented 4 years ago

可能是斗鱼封了ip或禁止了puppteer的抓取,index.js 34行打印response可能出现{ error: -11, msg: '非法访问设备', data: '' }导致的,可能要另想办法了

davidkingzyb commented 4 years ago

试下新的 https://github.com/davidkingzyb/pccold_puppeteer/blob/master/douyutv.py 参考 https://github.com/wbt5/real-url/blob/master/douyu.py

lawye commented 4 years ago

hmm, streamlink依然报错

随便找了一个在播的斗鱼直播间测试

--- Logging error ---
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/streamlink-0.14.2-py3.5.egg/streamlink/plugin/api/http_session.py", line 164, in request
    *args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/requests/sessions.py", line 519, in request
    prep = self.prepare_request(req)
  File "/usr/local/lib/python3.5/dist-packages/requests/sessions.py", line 462, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/usr/local/lib/python3.5/dist-packages/requests/models.py", line 313, in prepare
    self.prepare_url(url, params)
  File "/usr/local/lib/python3.5/dist-packages/requests/models.py", line 387, in prepare_url
    raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL '未开播': No schema supplied. Perhaps you meant http://未开播?

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/streamlink-0.14.2-py3.5.egg/streamlink_cli/main.py", line 242, in open_stream
    stream_fd = stream.open()
  File "/usr/local/lib/python3.5/dist-packages/streamlink-0.14.2-py3.5.egg/streamlink/stream/http.py", line 73, in open
    **self.args)
  File "/usr/local/lib/python3.5/dist-packages/streamlink-0.14.2-py3.5.egg/streamlink/plugin/api/http_session.py", line 175, in request
    raise err
streamlink.exceptions.StreamError: Unable to open URL: 未开播 (Invalid URL '未开播': No schema supplied. Perhaps you meant http://未开播?)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/streamlink-0.14.2-py3.5.egg/streamlink_cli/main.py", line 269, in output_stream
    stream_fd, prebuffer = open_stream(stream)
  File "/usr/local/lib/python3.5/dist-packages/streamlink-0.14.2-py3.5.egg/streamlink_cli/main.py", line 244, in open_stream
    raise StreamError("Could not open stream: {0}".format(err))
streamlink.exceptions.StreamError: Could not open stream: Unable to open URL: 未开播 (Invalid URL '未开播': No schema supplied. Perhaps you meant http://未开播?)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.5/logging/__init__.py", line 980, in emit
    msg = self.format(record)
  File "/usr/lib/python3.5/logging/__init__.py", line 830, in format
    return fmt.format(record)
  File "/usr/local/lib/python3.5/dist-packages/streamlink-0.14.2-py3.5.egg/streamlink/logger.py", line 122, in format
    record.message = record.getMessage()
  File "/usr/local/lib/python3.5/dist-packages/streamlink-0.14.2-py3.5.egg/streamlink/logger.py", line 45, in getMessage
    msg = msg.format(*self.args)
  File "/usr/local/lib/python3.5/dist-packages/streamlink-0.14.2-py3.5.egg/streamlink/stream/http.py", line 42, in __repr__
    return "<HTTPStream({0!r})>".format(self.url)
  File "/usr/local/lib/python3.5/dist-packages/streamlink-0.14.2-py3.5.egg/streamlink/stream/http.py", line 64, in url
    **valid_args(self.args)).prepare().url
  File "/usr/local/lib/python3.5/dist-packages/requests/models.py", line 267, in prepare
    hooks=self.hooks,
  File "/usr/local/lib/python3.5/dist-packages/requests/models.py", line 313, in prepare
    self.prepare_url(url, params)
  File "/usr/local/lib/python3.5/dist-packages/requests/models.py", line 387, in prepare_url
    raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL '未开播': No schema supplied. Perhaps you meant http://未开播?
Call stack:
  File "/usr/local/bin/streamlink", line 9, in <module>
    load_entry_point('streamlink==0.14.2', 'console_scripts', 'streamlink')()
  File "/usr/local/lib/python3.5/dist-packages/streamlink-0.14.2-py3.5.egg/streamlink_cli/main.py", line 1002, in main
    handle_url()
  File "/usr/local/lib/python3.5/dist-packages/streamlink-0.14.2-py3.5.egg/streamlink_cli/main.py", line 553, in handle_url
    handle_stream(plugin, streams, stream_name)
  File "/usr/local/lib/python3.5/dist-packages/streamlink-0.14.2-py3.5.egg/streamlink_cli/main.py", line 403, in handle_stream
    success = output_stream(stream)
  File "/usr/local/lib/python3.5/dist-packages/streamlink-0.14.2-py3.5.egg/streamlink_cli/main.py", line 273, in output_stream
    log.error("Try {0}/{1}: Could not open stream {2} ({3})", i + 1, args.retry_open, stream, err)
Unable to print the message and arguments - possible formatting error.
Use the traceback above to help find the error.
Traceback (most recent call last):
  File "/usr/local/bin/streamlink", line 9, in <module>
    load_entry_point('streamlink==0.14.2', 'console_scripts', 'streamlink')()
  File "/usr/local/lib/python3.5/dist-packages/streamlink-0.14.2-py3.5.egg/streamlink_cli/main.py", line 1002, in main
    handle_url()
  File "/usr/local/lib/python3.5/dist-packages/streamlink-0.14.2-py3.5.egg/streamlink_cli/main.py", line 553, in handle_url
    handle_stream(plugin, streams, stream_name)
  File "/usr/local/lib/python3.5/dist-packages/streamlink-0.14.2-py3.5.egg/streamlink_cli/main.py", line 403, in handle_stream
    success = output_stream(stream)
  File "/usr/local/lib/python3.5/dist-packages/streamlink-0.14.2-py3.5.egg/streamlink_cli/main.py", line 276, in output_stream
    console.exit("Could not open stream {0}, tried {1} times, exiting", stream, args.retry_open)
  File "/usr/local/lib/python3.5/dist-packages/streamlink-0.14.2-py3.5.egg/streamlink_cli/console.py", line 87, in exit
    formatted = msg.format(*args, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/streamlink-0.14.2-py3.5.egg/streamlink/stream/http.py", line 42, in __repr__
    return "<HTTPStream({0!r})>".format(self.url)
  File "/usr/local/lib/python3.5/dist-packages/streamlink-0.14.2-py3.5.egg/streamlink/stream/http.py", line 64, in url
    **valid_args(self.args)).prepare().url
  File "/usr/local/lib/python3.5/dist-packages/requests/models.py", line 267, in prepare
    hooks=self.hooks,
  File "/usr/local/lib/python3.5/dist-packages/requests/models.py", line 313, in prepare
    self.prepare_url(url, params)
  File "/usr/local/lib/python3.5/dist-packages/requests/models.py", line 387, in prepare_url
    raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL '未开播': No schema supplied. Perhaps you meant http://未开播?
davidkingzyb commented 4 years ago

未开播

davidkingzyb commented 4 years ago

注意修改douyutv.py里房间号

lawye commented 4 years ago

感谢, 修改了douyutv.py里的房间号以后可以正常使用了