yqchilde / JDMemberCloseAccount

学习python操作selenium的一个🌰 ,也是一种京东全自动退会方案
MIT License
1.23k stars 346 forks source link

关于linux下使用 #95

Open hclasmn opened 3 years ago

hclasmn commented 3 years ago

不知道作者有没有尝试过linux下无头?我安装的是chromium-browser

λ chromium-browser --version Chromium 92.0.4515.131 snap

下了chromedriver λ ./chromedriver Starting ChromeDriver 92.0.4515.107 (87a818b10553a07434ea9e2b6dccf3cbe7895134-refs/branch-heads/4515@{#1634}) on port 9515 Only local connections are allowed. Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe. ChromeDriver was started successfully.

但是执行main.py提示浏览器配置错误。不知道怎么解决,求教

yqchilde commented 2 years ago

没有尝试过,目前帮不到你,蹲个知道的有缘人

Ca11back commented 2 years ago

linux下friefox正常.linux firefox比较友好吧.可以试试 还有你这是手动运行driver了么?我怎么记得是python调用

hclasmn commented 2 years ago

linux下friefox正常.linux firefox比较友好吧.可以试试 还有你这是手动运行driver了么?我怎么记得是python调用

你是安装的firefox么,main调用是直接报错,手动运行了driver看了下输出而已,你是桌面linux么,我是想命令行然后远程来用的

hclasmn commented 2 years ago

手动运行driver看了下version而已

hclasmn commented 2 years ago

linux下friefox正常.linux firefox比较友好吧.可以试试 还有你这是手动运行driver了么?我怎么记得是python调用

用firefox的话,也要下driver么

Ca11back commented 2 years ago

linux下friefox正常.linux firefox比较友好吧.可以试试 还有你这是手动运行driver了么?我怎么记得是python调用

用firefox的话,也要下driver么

自己把debug打开看一下错误,firefox也要driver,firefox的下最新就行应该是

mrwangsg commented 2 years ago

建议你先查一下,chrome运行版本。你虽然自己安装了一版本,有可能系统原先也有了一版本,而且默认了它。

tofuliang commented 2 years ago

Linux懒人可以用这个镜像tofuliang/jd-member-close-account 或者可以自己build. 图片验证码识别的我用local没问题,其他没测试, baidu-aipeasyocr两个包没有装,OCR识别短信验证码的不能用这两个方式.

FROM python:3.9.7-slim

ADD https://github.com/tofuliang/aria2/releases/download/20211031/aria2c-linux-amd64.tar /tmp/aria2c.tar
ADD https://github.com/develar/7zip-bin/blob/master/linux/x64/7za?raw=true /usr/bin/7za
RUN cd /tmp && tar xf /tmp/aria2c.tar && mv aria2c /usr/bin/aria2c && chmod +x /usr/bin/aria2c && chmod +x /usr/bin/7za && rm /tmp/aria2c.tar && aria2c http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_95.0.4638.54-1_amd64.deb \
&& aria2c http://chromedriver.storage.googleapis.com/95.0.4638.54/chromedriver_linux64.zip \
&& dpkg -i google-chrome-stable_95.0.4638.54-1_amd64.deb || apt update && apt -y --fix-broken install && dpkg -i google-chrome-stable_95.0.4638.54-1_amd64.deb && google-chrome --version \
&& apt-get clean \
&& aria2c https://github.com/yqchilde/JDMemberCloseAccount/archive/refs/heads/main.zip && 7za x JDMemberCloseAccount-main.zip \
&& 7za e chromedriver_linux64.zip && mv chromedriver JDMemberCloseAccount-main/drivers/chromedriver \
&& cd JDMemberCloseAccount-main && cat requirements.txt |grep -vE "easyocr|baidu"|awk -F "~" '{print $1}'|xargs pip3 install --no-cache-dir \
&& cd / && mv /tmp/JDMemberCloseAccount-main /JDMemberCloseAccount

WORKDIR /JDMemberCloseAccount
hclasmn commented 2 years ago

tofuliang/jd-member-close-account

厉害了,感谢分享

892947707 commented 2 years ago

Linux懒人可以用这个镜像tofuliang/jd-member-close-account 或者可以自己build. 图片验证码识别的我用local没问题,其他没测试, baidu-aipeasyocr两个包没有装,OCR识别短信验证码的不能用这两个方式.

FROM python:3.9.7-slim

ADD https://github.com/tofuliang/aria2/releases/download/20211031/aria2c-linux-amd64.tar /tmp/aria2c.tar
ADD https://github.com/develar/7zip-bin/blob/master/linux/x64/7za?raw=true /usr/bin/7za
RUN cd /tmp && tar xf /tmp/aria2c.tar && mv aria2c /usr/bin/aria2c && chmod +x /usr/bin/aria2c && chmod +x /usr/bin/7za && rm /tmp/aria2c.tar && aria2c http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_95.0.4638.54-1_amd64.deb \
&& aria2c http://chromedriver.storage.googleapis.com/95.0.4638.54/chromedriver_linux64.zip \
&& dpkg -i google-chrome-stable_95.0.4638.54-1_amd64.deb || apt update && apt -y --fix-broken install && dpkg -i google-chrome-stable_95.0.4638.54-1_amd64.deb && google-chrome --version \
&& apt-get clean \
&& aria2c https://github.com/yqchilde/JDMemberCloseAccount/archive/refs/heads/main.zip && 7za x JDMemberCloseAccount-main.zip \
&& 7za e chromedriver_linux64.zip && mv chromedriver JDMemberCloseAccount-main/drivers/chromedriver \
&& cd JDMemberCloseAccount-main && cat requirements.txt |grep -vE "easyocr|baidu"|awk -F "~" '{print $1}'|xargs pip3 install --no-cache-dir \
&& cd / && mv /tmp/JDMemberCloseAccount-main /JDMemberCloseAccount

WORKDIR /JDMemberCloseAccount

感谢分享,只是还是报找不到驱动的错误

tofuliang commented 2 years ago

感谢分享,只是还是报找不到驱动的错误

你是如何使用的?详细描述一下?

hclasmn commented 2 years ago

tofuliang/jd-member-close-account docker run -it xxx /bin/sh进去python main.py或者-v出来修改好config都报错 image

892947707 commented 2 years ago

你是如何使用的?详细描述一下?

与楼上差不多,不过是docker run 的时候 -v 映射了本地config.yaml,进去容器内 cat config.yaml 也是我映射的文件内容

tofuliang commented 2 years ago

tofuliang/jd-member-close-account docker run -it xxx /bin/sh进去python main.py或者-v出来修改好config都报错 image

这看着你没有进去容器里执行啊,有个很关键的点,你们的config.yamlheadless 改为true了没有...

hclasmn commented 2 years ago

image hao好了,无头改下就可以了,下面测试下 image

hclasmn commented 2 years ago

但是清一色识别未果

tofuliang commented 2 years ago

但是清一色识别未果

不用docker时我也是这样,所以我上面说图片验证码识别的我用local没问题 另外,你的验证码接收地址应该也要改一下,如果jd_wstool不是在容器内运行,容器内部用localhost是连接不上的,如果用在容器内运行jd_wstool,要配置好端口转发.

892947707 commented 2 years ago

但是清一色识别未果

不用docker时我也是这样,所以我上面说图片验证码识别的我用local没问题 另外,你的验证码接收地址应该也要改一下,如果jd_wstool不是在容器内运行,容器内部用localhost是连接不上的,如果用在容器内运行jd_wstool,要配置好端口转发.

感谢,确实是headless的问题。调用内置wstool然后映射端口就可以收到验证码了,local可以识别图片验证码。谢谢!

hclasmn commented 2 years ago

但是清一色识别未果

不用docker时我也是这样,所以我上面说图片验证码识别的我用local没问题 另外,你的验证码接收地址应该也要改一下,如果jd_wstool不是在容器内运行,容器内部用localhost是连接不上的,如果用在容器内运行jd_wstool,要配置好端口转发.

我没用localhost。用的宿主机的

hclasmn commented 2 years ago

但是清一色识别未果

不用docker时我也是这样,所以我上面说图片验证码识别的我用local没问题 另外,你的验证码接收地址应该也要改一下,如果jd_wstool不是在容器内运行,容器内部用localhost是连接不上的,如果用在容器内运行jd_wstool,要配置好端口转发.

感谢,确实是headless的问题。调用内置wstool然后映射端口就可以收到验证码了,local可以识别图片验证码。谢谢!

你用的容器内的ws的?

892947707 commented 2 years ago

你用的容器内的ws的?

config.yaml内改jd_wstool: false

hclasmn commented 2 years ago

你用的容器内的ws的?

config.yaml内改jd_wstool: false

明白了

hclasmn commented 2 years ago

image 欧克了

LondyGhost commented 2 years ago

image 欧克了

这是无GUI环境跑的?

hclasmn commented 2 years ago

image 欧克了

这是无GUI环境跑的?

docker环境