只为便宜一点买微信读书会员.
根据实际操作, 还有如下未明确说明的特点:
linux | windows | macos
amd64 | arm64
chrome | MicrosoftEdge | firefox | safari
下载链接: weread-challenge.js
# 安装 nodejs
sudo apt install nodejs
# 老旧版本的 nodejs 需要安装 npm
sudo apt install npm
# 创建运行文件夹
mkdir -p $HOME/weread-challenge
cd $HOME/weread-challenge
# 安装依赖
npm install selenium-webdriver
# 通过环境变量设置运行参数
WEREAD_BROWSER="chrome"
# 运行
node weread-challenge.js
如需邮件通知, 需安装 nodemailer:
npm install nodemailer
services:
app:
image: jqknono/weread-challenge:latest
pull_policy: always
environment:
- WEREAD_REMOTE_BROWSER=http://selenium:4444
- WEREAD_DURATION=68
volumes:
- ./data:/app/data
depends_on:
selenium:
condition: service_healthy
selenium:
image: selenium/standalone-chrome:4.26
pull_policy: if_not_present
shm_size: 2gb
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- SE_ENABLE_TRACING=false
- SE_BIND_HOST=false
- SE_JAVA_DISABLE_HOSTNAME_VERIFICATION=false
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:4444/wd/hub/status"]
interval: 5s
timeout: 60s
retries: 10
保存为 docker-compose.yml
, 运行 docker compose up -d
.
# run selenium standalone
docker run --restart always -d --name selenium-live \
-v /var/run/docker.sock:/var/run/docker.sock \
--shm-size="2g" \
-p 4444:4444 \
-p 7900:7900 \
-e SE_ENABLE_TRACING=false \
-e SE_BIND_HOST=false \
-e SE_JAVA_DISABLE_HOSTNAME_VERIFICATION=false \
-e SE_NODE_MAX_INSTANCES=10 \
-e SE_NODE_MAX_SESSIONS=10 \
-e SE_NODE_OVERRIDE_MAX_SESSIONS=true \
selenium/standalone-chrome:4.26
# run weread-challenge
docker run --rm --name user-read \
-v $HOME/weread-challenge/user/data:/app/data \
-e WEREAD_REMOTE_BROWSER=http://172.17.0.2:4444 \
-e WEREAD_DURATION=68 \
weread-challenge:beta
# add another user
docker run --rm --name user2-read \
-v $HOME/weread-challenge/user2/data:/app/data \
-e WEREAD_REMOTE_BROWSER=http://172.17.0.2:4444 \
-e WEREAD_DURATION=68 \
weread-challenge:latest
WORKDIR=$HOME/weread-challenge
mkdir -p $WORKDIR
cd $WORKDIR
cat > $WORKDIR/docker-compose.yml <<EOF
services:
app:
image: jqknono/weread-challenge:latest
pull_policy: always
environment:
- WEREAD_REMOTE_BROWSER=http://selenium:4444
- WEREAD_DURATION=68
volumes:
- ./data:/app/data
depends_on:
selenium:
condition: service_healthy
selenium:
image: selenium/standalone-chrome:4.26
pull_policy: if_not_present
shm_size: 2gb
volumes:
- /var/run/docker.sock:/var/run/docker.sock
environment:
- SE_ENABLE_TRACING=false
- SE_BIND_HOST=false
- SE_JAVA_DISABLE_HOSTNAME_VERIFICATION=false
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:4444/wd/hub/status"]
interval: 5s
timeout: 60s
retries: 10
EOF
# 首次启动后, 需微信扫描二维码登录, 二维码保存在 $HOME/weread-challenge/data/login.png
# 每天早上 7 点启动, 阅读 68 分钟
(crontab -l 2>/dev/null; echo "00 07 * * * cd $WORKDIR && docker compose up -d") | crontab -
# 启动浏览器
docker run --restart always -d --name selenium-live \
-v /var/run/docker.sock:/var/run/docker.sock \
--shm-size="2g" \
-p 4444:4444 \
-p 7900:7900 \
-e SE_ENABLE_TRACING=false \
-e SE_BIND_HOST=false \
-e SE_JAVA_DISABLE_HOSTNAME_VERIFICATION=false \
-e SE_NODE_MAX_INSTANCES=3 \
-e SE_NODE_MAX_SESSIONS=3 \
-e SE_NODE_OVERRIDE_MAX_SESSIONS=true \
-e SE_SESSION_REQUEST_TIMEOUT=10 \
-e SE_SESSION_RETRY_INTERVAL=3 \
selenium/standalone-chrome:4.26
WEREAD_USER="user"
mkdir -p $HOME/weread-challenge/$WEREAD_USER/data
# Get container IP
Selenium_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' selenium-live)
# 首次启动后, 需微信扫描二维码登录, 二维码保存在 $HOME/weread-challenge/$WEREAD_USER/data/login.png
# 每天早上 7 点启动, 阅读 68 分钟
(crontab -l 2>/dev/null; echo "00 07 * * * docker run --rm --name ${WEREAD_USER}-read -v $HOME/weread-challenge/${WEREAD_USER}/data:/app/data -e WEREAD_REMOTE_BROWSER=http://${Selenium_IP}:4444 -e WEREAD_DURATION=68 -e WEREAD_USER=${WEREAD_USER} jqknono/weread-challenge:latest") | crontab -
# 安装 nodejs
winget install -e --id Node.js.Node.js
# 创建运行文件夹
mkdir -p $HOME/weread-challenge
cd $HOME/weread-challenge
# 安装依赖
npm install selenium-webdriver
# 通过环境变量设置运行参数
$WEREAD_BROWSER="MicrosoftEdge"
# 运行
node weread-challenge.js
Docker 运行同 Linux.
# 安装 nodejs
brew install node
# 创建运行文件夹
mkdir -p $HOME/weread-challenge
# 安装依赖
npm install selenium-webdriver
# 通过环境变量设置运行参数
WEREAD_BROWSER="safari"
# 运行
node weread-challenge.js
Docker 运行同 Linux.
# 启动浏览器
docker run --restart always -d --name selenium-live \
-v /var/run/docker.sock:/var/run/docker.sock \
--shm-size="2g" \
-p 4444:4444 \
-p 7900:7900 \
-e SE_ENABLE_TRACING=false \
-e SE_BIND_HOST=false \
-e SE_JAVA_DISABLE_HOSTNAME_VERIFICATION=false \
-e SE_NODE_MAX_INSTANCES=10 \
-e SE_NODE_MAX_SESSIONS=10 \
-e SE_NODE_OVERRIDE_MAX_SESSIONS=true \
selenium/standalone-chrome:4.26
WEREAD_USER1="user1"
WEREAD_USER2="user2"
mkdir -p $HOME/weread-challenge/$WEREAD_USER1/data
mkdir -p $HOME/weread-challenge/$WEREAD_USER2/data
# Get container IP
Selenium_IP=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' selenium-live)
# 首次启动后, 需微信扫描二维码登录, 二维码保存在:
# /$HOME/weread-challenge/${WEREAD_USER1}/data/login.png
# /$HOME/weread-challenge/${WEREAD_USER2}/data/login.png
# 每天早上 7 点启动, 阅读 68 分钟
(crontab -l 2>/dev/null; echo "00 07 * * * docker run --rm --name ${WEREAD_USER1}-read -v $HOME/weread-challenge/${WEREAD_USER1}/data:/app/data -e WEREAD_REMOTE_BROWSER=http://${Selenium_IP}:4444 -e WEREAD_DURATION=68 -e WEREAD_USER=${WEREAD_USER1} jqknono/weread-challenge:latest") | crontab -
(crontab -l 2>/dev/null; echo "00 07 * * * docker run --rm --name ${WEREAD_USER2}-read -v $HOME/weread-challenge/${WEREAD_USER2}/data:/app/data -e WEREAD_REMOTE_BROWSER=http://${Selenium_IP}:4444 -e WEREAD_DURATION=68 -e WEREAD_USER=${WEREAD_USER2} jqknono/weread-challenge:latest") | crontab -
环境变量 | 默认值 | 可选值 | 说明 |
---|---|---|---|
WEREAD_USER |
weread-default |
- | 用户标识 |
WEREAD_REMOTE_BROWSER |
"" | - | 远程浏览器地址 |
WEREAD_DURATION |
10 |
- | 阅读时长 |
WEREAD_SELECTION |
random |
[0-4] | 选择阅读的书籍 |
WEREAD_BROWSER |
chrome |
chrome,MicrosoftEdge,firefox,safari |
浏览器 |
ENABLE_EMAIL |
false |
true,false |
邮件通知 |
EMAIL_SMTP |
"" | - | 邮箱 SMTP 服务器 |
EMAIL_USER |
"" | - | 邮箱用户名 |
EMAIL_PASS |
"" | - | 邮箱密码 |
EMAIL_TO |
"" | - | 收件人 |
WEREAD_AGREE_TERMS |
true |
true,false |
隐私同意条款 |
支持 linux/amd64,linux/arm64, 支持树莓派等开发板.
docker buildx create --name weread-challenge
docker buildx use weread-challenge
docker buildx inspect --bootstrap
docker buildx build --platform linux/amd64,linux/arm64 -t jqknono/weread-challenge:base -f Dockerfile.base --push .
docker buildx build --platform linux/amd64,linux/arm64 -t jqknono/weread-challenge:latest -f Dockerfile.quick --push .
[email protected]
, 本项目会立即删除cookies
部分信息, 以用于使用者统计和展示.用户名称 | 首次使用时间 | 最近使用时间 | 总使用次数 | 浏览器类型 | 操作系统类别 | 阅读时长设置 | 异常退出原因
WEREAD_AGREE_TERMS=false
cookies
可用于微信读书网页登录, 登录后可以执行书架操作, 但本工具不会使用搜集的信息进行登录操作.设置
->登录设备
中确认登录设备. 1
Meld 15 小时 49 分钟前
可以考虑放到青龙面板里
|
2
tanranran 15 小时 45 分钟前
+1
|
3
Gcourage 10 小时 0 分钟前
macOS node22.9 执行的时候提示 TypeError: _0x2f1dd9[("addArgumen" + "ts")] is not a function
|