Giter VIP home page Giter VIP logo

auto-read-liunxdo's Introduction

中文文档

Method 1: Tampermonkey Script

The Tampermonkey script can be accessed in the index_passage_list. You can find and install the script from Greasy Fork:

alt text Tampermonkey Script: Auto Read

Method 2: Headless Execution with Puppeteer

1. Setting Environment Variables

Set your username and password in the .env file.

2. Execution

For Windows

Run the following commands:

npm install
node .\pteer.js

For Linux (additional packages needed)

Install the required packages and run the same commands as for Windows:

sudo apt-get update
sudo apt install nodejs npm -y
sudo apt-get install -y wget unzip fontconfig locales gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget

Method 3: GitHub Actions for Daily Reading at Midnight

Modify the start time and duration as needed. The code is located in .github/workflows/cron_read.yaml.

1. Fork the Repository

2. Set Environment Variables

Set the username and password in the secrets of GitHub actions (variable names can be referred from .env). Note that setting the environment variables in .env here does not work for GitHub actions. alt text

3. Start the Workflow

Tutorial: Enable Automatic Updates

Method 4: Docker Execution

1. Immediate Execution

Clone the repository, set environment variables in docker-compose.yml, and run:

docker-compose up -d

To view logs:

docker-compose logs -f

2. Scheduled Execution

Set permissions and edit the crontab:

chmod +x cron.sh
crontab -e

Manually add the following entry (to execute daily at 6 AM, adjust the directory as needed):

0 6 * * * /root/auto-read-linuxdo/cron.sh  # Note this is a sample directory, change to your repository's cron.sh directory (use pwd to find your directory)

Additional Information

The external script is used for puppeteer and is modified from index_passage_list.js. Main modifications include removing buttons and setting automatic reading and liking to start by default:

localStorage.setItem("read", "true"); // Initially disables auto-scroll
localStorage.setItem("autoLikeEnabled", "true"); // Auto-liking is enabled by default

auto-read-liunxdo's People

Contributors

14790897 avatar icpd avatar imgbotapp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

auto-read-liunxdo's Issues

linux 运行报错

root@ubuntu:~/auto_linuxdo# npm install

[email protected] postinstall /root/auto_linuxdo/node_modules/puppeteer
node install.mjs

/root/auto_linuxdo/node_modules/puppeteer/install.mjs:31
const {downloadBrowser} = await importInstaller();
^^^^^

SyntaxError: await is only valid in async function
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)

docker部署起来以后,没有任何日志

打包docker镜像,运行无法使用,报错

  • 使用项目内的Dockerfile构建
  • 使用docker-compose启动
  • 错误日志
liunxdo  | /app/node_modules/puppeteer-core/lib/cjs/puppeteer/util/disposable.js:9
liunxdo  | Symbol.dispose ??= Symbol('dispose');
liunxdo  |                ^^^
liunxdo  | 
liunxdo  | SyntaxError: Unexpected token '??='
liunxdo  |     at wrapSafe (internal/modules/cjs/loader.js:1029:16)
liunxdo  |     at Module._compile (internal/modules/cjs/loader.js:1078:27)
liunxdo  |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
liunxdo  |     at Module.load (internal/modules/cjs/loader.js:979:32)
liunxdo  |     at Function.Module._load (internal/modules/cjs/loader.js:819:12)
liunxdo  |     at Module.require (internal/modules/cjs/loader.js:1003:19)
liunxdo  |     at require (internal/modules/cjs/helpers.js:107:18)
liunxdo  |     at Object.<anonymous> (/app/node_modules/puppeteer-core/lib/cjs/puppeteer/common/EventEmitter.js:13:25)
liunxdo  |     at Module._compile (internal/modules/cjs/loader.js:1114:14)
liunxdo  |     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
liunxdo exited with code 1

Failed to load resource: the server responded with a status of 429 ()

"Failed to load resource: the server responded with a status of 429"这个提示正常吗?
下面是具体的日志:

登录操作
PAGE LOG: JSHandle@node
PAGE LOG: Login button clicked.
PAGE LOG: Autofocus processing was blocked because a document already has a focused element.
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd8e9bb0 — Ember v5.5.0
找到avatarImg,登录成功
Page error: Cannot read properties of null (reading 'appendChild')
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd8e9bb0 — Ember v5.5.0
PAGE LOG: 脚本第一次运行,执行初始化操作...
PAGE LOG: 执行了初始数据更新操作
PAGE LOG: autoRead true autoLikeEnabled true
PAGE LOG: 执行正常的滚动和检查逻辑
PAGE LOG: 已滚动到底部
Page error: Cannot read properties of null (reading 'appendChild')
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd8e9bb0 — Ember v5.5.0
PAGE LOG: 脚本非第一次运行
PAGE LOG: autoRead true autoLikeEnabled true
PAGE LOG: 正在导航到下一个话题
PAGE LOG: Found link: https://linux.do/t/topic/6022
Page error: Cannot read properties of null (reading 'appendChild')
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd8e9bb0 — Ember v5.5.0
PAGE LOG: 脚本非第一次运行
PAGE LOG: autoRead true autoLikeEnabled true
PAGE LOG: 执行正常的滚动和检查逻辑
PAGE LOG: Clicked like button 1
PAGE LOG: Clicked like button 2
PAGE LOG: Clicked like button 3
PAGE LOG: Clicked like button 4
PAGE LOG: Clicked like button 5
PAGE LOG: Clicked like button 6
PAGE LOG: Clicked like button 7
PAGE LOG: Clicked like button 8
PAGE LOG: Clicked like button 9
PAGE LOG: Clicked like button 10
PAGE LOG: Clicked like button 11
PAGE LOG: Failed to load resource: the server responded with a status of 429 ()
PAGE LOG: Clicked like button 12
PAGE LOG: Failed to load resource: the server responded with a status of 429 ()
PAGE LOG: Clicked like button 13
PAGE LOG: Failed to load resource: the server responded with a status of 429 ()
PAGE LOG: Clicked like button 14
PAGE LOG: Failed to load resource: the server responded with a status of 429 ()
Retrying now...
PAGE LOG: Clicked like button 15
Page error: Cannot read properties of null (reading 'appendChild')
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd8e9bb0 — Ember v5.5.0
PAGE LOG: 脚本非第一次运行
PAGE LOG: autoRead true autoLikeEnabled false
PAGE LOG: 执行正常的滚动和检查逻辑
PAGE LOG: Failed to load resource: the server responded with a status of 429 ()

PAGE LOG: No link with the specified format was found.

PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.
PAGE LOG: No link with the specified format was found.

一直刷这个正常吗?

这算运行成功了吗

Code
Pull requests
Scheduled Node.js CI
Scheduled Node.js CI #2
build (20.x)
Started 2m 52s ago
Beta
Give feedback
1s
0s
3s
12s
2m 37s
Run node pteer.js
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd8e9bb0 — Ember v5.5.0
PAGE LOG: [DOM] Input elements should have autocomplete attributes (suggested: "current-password"): (More info: https://goo.gl/9p2vKq) %o
登录操作
PAGE LOG: JSHandle@node
PAGE LOG: Login button clicked.
PAGE LOG: Autofocus processing was blocked because a document already has a focused element.
PAGE LOG: ℹ️ Discourse v3.2.1https://github.com/discourse/discourse/commits/5abd8e9bb0 — Ember v5.5.0
找到avatarImg,登录成功
Page error: Cannot read properties of null (reading 'appendChild')
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd8e9bb0 — Ember v5.5.0
PAGE LOG: 脚本第一次运行,执行初始化操作...
PAGE LOG: 执行了初始数据更新操作
PAGE LOG: autoRead true autoLikeEnabled true
PAGE LOG: 执行正常的滚动和检查逻辑
PAGE LOG: 已滚动到底部
Page error: Cannot read properties of null (reading 'appendChild')
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd8e9bb0 — Ember v5.5.0
PAGE LOG: 脚本非第一次运行
PAGE LOG: autoRead true autoLikeEnabled true
PAGE LOG: 正在导航到下一个话题
PAGE LOG: Found link: https://linux.do/t/topic/48228/4
Page error: Cannot read properties of null (reading 'appendChild')
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd8e9bb0 — Ember v5.5.0
PAGE LOG: 脚本非第一次运行
PAGE LOG: autoRead true autoLikeEnabled true
PAGE LOG: 执行正常的滚动和检查逻辑
PAGE LOG: Clicked like button 1
PAGE LOG: Clicked like button 2
PAGE LOG: Clicked like button 3
PAGE LOG: Clicked like button 4
PAGE LOG: Clicked like button 5
PAGE LOG: Clicked like button 6
PAGE LOG: Clicked like button 7
PAGE LOG: Clicked like button 8
PAGE LOG: Clicked like button 9
PAGE LOG: Clicked like button 10
PAGE LOG: Failed to load resource: the server responded with a status of 429 ()
PAGE LOG: Failed to update topic times for topic 48228 due to 429 error
PAGE LOG: Clicked like button 11
PAGE LOG: 已滚动到底部
PAGE LOG: Failed to load resource: the server responded with a status of 429 ()
PAGE LOG: Failed to load resource: the server responded with a status of 429 ()
Page error: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
Page error: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
Page error: Failed to read the 'localStorage' property from 'Window': Access is denied for this document.
Retrying now...
Page error: Cannot read properties of null (reading 'appendChild')
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd8e9bb0 — Ember v5.5.0
PAGE LOG: 脚本非第一次运行
PAGE LOG: autoRead true autoLikeEnabled false
PAGE LOG: 正在导航到下一个话题
PAGE LOG: Found link: https://linux.do/t/topic/47799/5
Page error: Cannot read properties of null (reading 'appendChild')
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd[8](https://github.com/ericsgit2/auto-read-liunxdo/actions/runs/8571131277/job/23490690522#step:5:9)e9bb0 — Ember v5.5.0
PAGE LOG: 脚本非第一次运行
PAGE LOG: autoRead true autoLikeEnabled false
PAGE LOG: 执行正常的滚动和检查逻辑
PAGE LOG: 已滚动到底部
Page error: Cannot read properties of null (reading 'appendChild')
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd8e[9](https://github.com/ericsgit2/auto-read-liunxdo/actions/runs/8571131277/job/23490690522#step:5:10)bb0 — Ember v5.5.0
PAGE LOG: 脚本非第一次运行
PAGE LOG: autoRead true autoLikeEnabled false
PAGE LOG: 正在导航到下一个话题
PAGE LOG: Found link: https://linux.do/t/topic/37675/459
Page error: Cannot read properties of null (reading 'appendChild')
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd8e9bb0 — Ember v5.5.0
PAGE LOG: 脚本非第一次运行
PAGE LOG: autoRead true autoLikeEnabled false
PAGE LOG: 执行正常的滚动和检查逻辑
PAGE LOG: 已滚动到底部
Page error: Cannot read properties of null (reading 'appendChild')
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd8e9bb0 — Ember v5.5.0
PAGE LOG: 脚本非第一次运行
PAGE LOG: autoRead true autoLikeEnabled false
PAGE LOG: 正在导航到下一个话题
PAGE LOG: Found link: https://linux.do/t/topic/48[12](https://github.com/ericsgit2/auto-read-liunxdo/actions/runs/8571131277/job/23490690522#step:5:13)9/34
Page error: Cannot read properties of null (reading 'appendChild')
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd8e9bb0 — Ember v5.5.0
PAGE LOG: 脚本非第一次运行
PAGE LOG: autoRead true autoLikeEnabled false
PAGE LOG: 执行正常的滚动和检查逻辑
PAGE LOG: 已滚动到底部
Page error: Cannot read properties of null (reading 'appendChild')
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd8e9bb0 — Ember v5.5.0
PAGE LOG: 脚本非第一次运行
PAGE LOG: autoRead true autoLikeEnabled false
PAGE LOG: 正在导航到下一个话题
PAGE LOG: Found link: https://linux.do/t/topic/47930/39
Page error: Cannot read properties of null (reading 'appendChild')
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd8e9bb0 — Ember v5.5.0
PAGE LOG: 脚本非第一次运行
PAGE LOG: autoRead true autoLikeEnabled false
PAGE LOG: 执行正常的滚动和检查逻辑
PAGE LOG: 已滚动到底部
Page error: Cannot read properties of null (reading 'appendChild')
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd8e9bb0 — Ember v5.5.0
PAGE LOG: 脚本非第一次运行
PAGE LOG: autoRead true autoLikeEnabled false
PAGE LOG: 正在导航到下一个话题
PAGE LOG: Found link: https://linux.do/t/topic/48267/7
Page error: Cannot read properties of null (reading 'appendChild')
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd8e9bb0 — Ember v5.5.0
PAGE LOG: 脚本非第一次运行
PAGE LOG: autoRead true autoLikeEnabled false
PAGE LOG: 执行正常的滚动和检查逻辑
PAGE LOG: 已滚动到底部
Page error: Cannot read properties of null (reading 'appendChild')
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd8e9bb0 — Ember v5.5.0
PAGE LOG: 脚本非第一次运行
PAGE LOG: autoRead true autoLikeEnabled false
PAGE LOG: 正在导航到下一个话题
PAGE LOG: Found link: https://linux.do/t/topic/174[13](https://github.com/ericsgit2/auto-read-liunxdo/actions/runs/8571131277/job/23490690522#step:5:14)/935
Page error: Cannot read properties of null (reading 'appendChild')
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd8e9bb0 — Ember v5.5.0
PAGE LOG: 脚本非第一次运行
PAGE LOG: autoRead true autoLikeEnabled false
PAGE LOG: 执行正常的滚动和检查逻辑
PAGE LOG: 已滚动到底部
Page error: Cannot read properties of null (reading 'appendChild')
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd8e9bb0 — Ember v5.5.0
PAGE LOG: 脚本非第一次运行
PAGE LOG: autoRead true autoLikeEnabled false
PAGE LOG: 正在导航到下一个话题
PAGE LOG: Found link: https://linux.do/t/topic/48127
Page error: Cannot read properties of null (reading 'appendChild')
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd8e9bb0 — Ember v5.5.0
PAGE LOG: 脚本非第一次运行
PAGE LOG: autoRead true autoLikeEnabled false
PAGE LOG: 执行正常的滚动和检查逻辑
PAGE LOG: 已滚动到底部
Page error: Cannot read properties of null (reading 'appendChild')
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd8e9bb0 — Ember v5.5.0
PAGE LOG: 脚本非第一次运行
PAGE LOG: autoRead true autoLikeEnabled false
PAGE LOG: 正在导航到下一个话题
PAGE LOG: Found link: https://linux.do/t/topic/[17](https://github.com/ericsgit2/auto-read-liunxdo/actions/runs/8571131277/job/23490690522#step:5:18)413/1
Page error: Cannot read properties of null (reading 'appendChild')
PAGE LOG: ℹ️ Discourse v3.2.1 — https://github.com/discourse/discourse/commits/5abd8e9bb0 — Ember v5.5.0
PAGE LOG: 脚本非第一次运行
PAGE LOG: autoRead true autoLikeEnabled false
PAGE LOG: 执行正常的滚动和检查逻辑

Win/Webstorm 报错

Win11 22621;Webstorm 2024.1;Node.js v21.6.2.
问题:const usernames = process.env.USERNAMES.split(", ");
^

TypeError: Cannot read properties of undefined (reading 'split')
at Object. (F:\hsy\code\auto-read-liunxdo\pteer.js:7:41)
at Module._compile (node:internal/modules/cjs/loader:1378:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1437:10)
at Module.load (node:internal/modules/cjs/loader:1212:32)
at Module._load (node:internal/modules/cjs/loader:1028:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:142:12)
at node:internal/main/run_main_module:28:49

Node.js v21.6.2

进程已结束,退出代码为 1
.env为原始状态

非workflow模式下,如何指定阅读时间?

请教下,如果使用非github action的workflow模式下,如何指定阅读时间?用docker的方式,可以指定阅读时长么?还是说docker方式就是一直阅读,直到出现429错误自己退出?现在是在操作系统里的cron配置了定时做docker-compose down

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.