pref: 去除对unzipper的依赖

feat: 专栏转发率达一半以上时跳过
This commit is contained in:
shanmite 2021-07-28 13:02:12 +08:00
parent 8bc053b352
commit 236fcb6284
4 changed files with 24 additions and 14 deletions

View File

@ -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})`);
@ -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
}

View File

@ -10,7 +10,7 @@ const metainfo = [
` __/ | | | `,
` |___/ |_| `,
` `,
` v1.9.5 by shanmite`,
` v1.9.6 by shanmite`,
]
/**多账号存储 */
let multiple_account = [];

View File

@ -23,7 +23,7 @@
},
"repository": {
"type": "git",
"url": "https://github.com/shanmite/AutoScript.git"
"url": "https://github.com/shanmiteko/AutoScript.git"
},
"keywords": [
"auto",
@ -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"
}
}

View File

@ -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
}