Skip to content

Commit

Permalink
pref: 去除对unzipper的依赖
Browse files Browse the repository at this point in the history
feat: 专栏转发率达一半以上时跳过
  • Loading branch information
shanmiteko committed Jul 28, 2021
1 parent 8bc053b commit 236fcb6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 14 deletions.
22 changes: 14 additions & 8 deletions lib/Public.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function modifyDynamicRes(res) {
*/
array = next.has_more === 0
? []
: cards.map(onecard => parseDynamicCard(onecard))
: cards.map(parseDynamicCard)

log.info('处理动态数据', `动态数据读取完毕(${cards.length})(${next.has_more})`);

Expand Down Expand Up @@ -298,17 +298,23 @@ class Public {

let dyinfos = [];
for (const cv of cvs) {
const content = await BiliAPI.getOneArticleByCv(cv)
, dyids = content.match(/(?<=t.bilibili.com\/)[0-9]+/g) || [];
let { length } = dyids,
const
content = await BiliAPI.getOneArticleByCv(cv),
dyids = content.match(/(?<=t.bilibili.com\/)[0-9]+/g) || [],
/**判断此专栏是否查看过的权重 */
weight = 8;
weight = dyids.length / 2;

let { length } = dyids;

log.info('获取动态', `提取专栏(${cv})中提及的dyid(${length})`)
for (const dyid of dyids) {
let _weight = 0;
const isRelayed = await MyStorage.searchDyid(dyid);
weight = isRelayed ? weight - 1 : 8;
if (weight < 0) {
log.info('获取动态', '连续8条动态曾经转过,该专栏或已查看,故中止')
if (isRelayed) {
_weight += 1;
}
if (_weight >= weight) {
log.info('获取动态', `1/2动态曾经转过,该专栏或已查看,故中止`)
dyinfos = []
break
}
Expand Down
2 changes: 1 addition & 1 deletion main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const metainfo = [
` __/ | | | `,
` |___/ |_| `,
` `,
` v1.9.5 by shanmite`,
` v1.9.6 by shanmite`,
]
/**多账号存储 */
let multiple_account = [];
Expand Down
9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/shanmite/AutoScript.git"
"url": "https://github.com/shanmiteko/AutoScript.git"
},
"keywords": [
"auto",
Expand All @@ -32,16 +32,15 @@
"author": "shanmite",
"license": "GPL-3.0-or-later",
"bugs": {
"url": "https://github.com/shanmite/AutoScript/issues"
"url": "https://github.com/shanmiteko/AutoScript/issues"
},
"homepage": "https://github.com/shanmite/AutoScript#readme",
"homepage": "https://github.com/shanmiteko/AutoScript#readme",
"devDependencies": {
"eslint": "^7.17.0",
"pkg": "^5.2.1"
},
"dependencies": {
"chalk": "^4.1.1",
"nodemailer": "^6.5.0",
"unzipper": "^0.10.11"
"nodemailer": "^6.5.0"
}
}
5 changes: 5 additions & 0 deletions script/pkg/pkg.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ foreach ($TRI in $TRIARR) {
Move-Item -Path $BIN -Destination $DIR -Force
Copy-Item -Path $ENV_FILE -Destination $DIR -Force
Copy-Item -Path $CONFIG_FILE -Destination $DIR -Force
if ($DIR -eq "nlts-win-x64") {
New-Item -Path $DIR -Name "start.bat" -ItemType File -Value "@echo off && lottery start && pause" -Force
New-Item -Path $DIR -Name "check.bat" -ItemType File -Value "@echo off && lottery check && pause" -Force
New-Item -Path $DIR -Name "clear.bat" -ItemType File -Value "@echo off && lottery clear && pause" -Force
}

Compress-Archive -Path $DIR -DestinationPath "$($DIR)-$(Get-Date -Format "yyyyMMd")" -Force
}
Expand Down

0 comments on commit 236fcb6

Please sign in to comment.