[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #28

Merged
merged 9 commits into from
Jan 22, 2022
Merged

Dev #28

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
- [安装时可能出现的问题](#安装时可能出现的问题)

# 懒人包
懒人包试运行中,请前往 发布页面 下载使用~
懒人包试运行中,仅支持 Win10 及以上,请前往 发布页面 下载使用~
- [国内](https://gitee.com/cn_shaw/acfun-live/releases)
- [海外](https://github.com/shilx/acfun-live/releases)

# AcFun-Live
使用 Puppeteer 开启 AcFun 直播监控室,挂牌子,还有开播通知!😏
定时检查已开播并且拥有粉丝牌的直播间,根据设置进行操作。
Windows、WSL、Linux的 x86 和 ARM 架构均可运行~
Windows、WSL、Linux均可运行~
支持多台机子,请保持每台机子配置相同。
(序列形式的负载,并不是真正的均衡负载,因为实现起来比较容易😆)
- dev 分支
Expand Down
6 changes: 6 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ const Start = () => {
'--suppress-message-center-popups',
]
}).then(async browser => {
console.log('puppeteer launched,Cookie状态:', config.cookies !== '');
const pageList = await browser.pages()
const page = pageList[0]
await requestFliter(page)
Expand Down Expand Up @@ -101,6 +102,11 @@ const Start = () => {

// 起飞
startMonitor(browser)
}).catch(err => {
console.log('puppeteer启动失败,1秒稍后重试', err);
setTimeout(() => {
Start()
}, 1000)
})
}

Expand Down
38 changes: 20 additions & 18 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
{
"cookies": "",
"account": "",
"password": "",
"checkLiveTimeout": 10,
"likeBtnTimeout": 0,
"defaultTimeout": 5,
"executablePath": "",
"uidUnwatchList": [],
"showLiveInfo": true,
"checkWearMedal": false,
"serverRoomLimit": [0],
"serverIndex": 0,
"checkAllRoom": false,
"useObsDanmaku": true,
"notification": false,
"iftttKey": "",
"barkKey": "",
"mux": "auto"
"account": "",
"password": "",
"checkLiveTimeout": 10,
"likeBtnTimeout": 0,
"defaultTimeout": 5,
"executablePath": "",
"uidUnwatchList": [],
"showLiveInfo": true,
"checkWearMedal": false,
"serverRoomLimit": [
0
],
"serverIndex": 0,
"checkAllRoom": false,
"useObsDanmaku": true,
"notification": false,
"iftttKey": "",
"barkKey": "",
"mux": "auto",
"cookies": ""
}
6 changes: 4 additions & 2 deletions evaluateHandle.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ module.exports = (action, page, data) => {
return handleProxy({
page,
action: `${data} ${action}`,
url: `https://www.acfun.cn/rest/pc-direct/fansClub/fans/medal/degreeLimit?uperId=${data}`
// url: `https://www.acfun.cn/rest/pc-direct/fansClub/fans/medal/degreeLimit?uperId=${data}`,
// 2022年1月13日16点56分 猴子改接口
url: `https://www.acfun.cn/rest/pc-direct/fansClub/fans/medal/extraInfo?uperId=${data}`
})
.then(res =>
res.medalDegreeLimit
Expand Down Expand Up @@ -166,4 +168,4 @@ module.exports = (action, page, data) => {
handleError: `未知请求 ${action}`
})
}
}
}
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "acfun-live",
"version": "1.3.6",
"version": "1.3.7",
"description": "使用 Puppeteer 开启 acfun 直播监控室,挂牌子!😏",
"main": "index.js",
"bin": "app.js",
Expand Down
19 changes: 14 additions & 5 deletions pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,24 +484,33 @@ const handlePageError = async (page, uperName, err) => {
console.error(`第${errorTimes[uperName]}次 handlePageError`, uperName, errorTimes[uperName] > 5)
if (typeof err === 'object') {
if (err.error) {
console.log(6, err);
console.log('[错误为object]', err);
} else if (typeof err.message === 'string') {
console.log(3, err.message);
console.log('[错误为object并且有message]', err.message);
} else {
JSON.stringify(4, err.message)
JSON.stringify('[未知错误]', err.message)
if (err.message.error) {
console.log(5, err.message.error);
console.log('[未知错误的object]', err.message.error);
}
}
} else {
console.log(2, err);
console.log('[错误为文本]', err);
}

if (errorTimes[uperName] === 'loading') {
console.log(uperName, `handlePageError 已超过5次,刷新页面中...`);
return
}
if (errorTimes[uperName] > 5) {
console.log(uperName, `handlePageError 超过5次,刷新页面`);
errorTimes[uperName] = 'loading'
page.reload().then(() => {
console.log(uperName, `handlePageError 刷新完毕`);
page.evaluate(uperName => document.title = uperName, uperName)
}).catch(err => {
console.log(uperName, `handlePageError 刷新失败`);
console.log(err);
}).finally(() => {
errorTimes[uperName] = 0
})
}
Expand Down