Compare commits

..
5 Commits
Author SHA1 Message Date
shanmite fabe9f7d6e docs: 更新CHANGELOG 2021-11-09 19:13:32 +08:00
jkluio78andshanmite 1962d97bc1 fix: 过滤专栏时间失效(#67) 2021-11-09 19:04:07 +08:00
shanmite c43ab13790 docs: 更新CHANGELOG 2021-11-08 16:04:13 +08:00
shanmite 11625b3850 feat: 检索专栏时能够根据发布时间进行过滤(#65) 2021-11-08 15:40:10 +08:00
shanmite 8c7a6d13d6 fix: 多帐号设置未更新
未填写对应的config_n导致沿用之前的设置
2021-11-08 11:31:43 +08:00
7 changed files with 49 additions and 13 deletions
+19
View File
@@ -1,5 +1,24 @@
<!-- markdownlint-disable MD036 MD024-->
# CHANGELOG
## 主要变化(2.3.4)
* 1962d97 fix: 过滤专栏时间失效(#67)
## 较上一版本变化
只变更可执行文件
_如果之前版本小于上一版本,请查看[CHANGELOG](CHANGELOG.md)变更说明_
**Full Changelog**: https://github.com/shanmiteko/LotteryAutoScript/compare/v2.3.2...v2.3.4
## 主要变化(2.3.3)
* 11625b3 feat: 检索专栏时能够根据发布时间进行过滤(#65)
* 8c7a6d1 fix: 多帐号设置未更新
## 较上一版本变化
[my_config.js](my_config.example.js)增加
* `article_create_time` - 专栏创建时间距离现在的最大天数
_如果之前版本小于上一版本,请查看[CHANGELOG](CHANGELOG.md)变更说明_
**Full Changelog**: https://github.com/shanmiteko/LotteryAutoScript/compare/v2.3.2...v.2.3.3
## 主要变化(2.3.2)
+1 -1
View File
@@ -205,7 +205,7 @@ class Monitor extends Searcher {
return true
});
if (lottery_param[0] !== "APIs" && set_lottery_info_url) {
if (lottery_param[0] !== "APIs" && set_lottery_info_url && protoLotteryInfo.length) {
log.info("上传抽奖信息", "开始")
await new Promise((resolve) => {
send({
+9 -4
View File
@@ -1,7 +1,7 @@
const utils = require('../utils');
const bili = require('../net/bili');
const { send } = require("../net/http");
const { article_scan_page, not_check_article, get_dynamic_detail_wait, uid_scan_page, search_wait, tag_scan_page } = require("../data/config");
const { article_scan_page, article_create_time, not_check_article, get_dynamic_detail_wait, uid_scan_page, search_wait, tag_scan_page } = require("../data/config");
const { log } = utils
@@ -336,9 +336,14 @@ class Searcher {
/**存储所有专栏中的dyid */
let dyinfos = [];
/**遍历专栏s */
for (const cv of cvs) {
for (const { id, pub_time } of cvs) {
let now_time = Math.floor(Date.now() / 1000);
if ((now_time - pub_time) / 86400 > article_create_time) {
log.warn("获取动态", `该专栏(${id})创建时间大于设定天数(${article_create_time}天)`)
continue
}
const
content = await bili.getOneArticleByCv(cv),
content = await bili.getOneArticleByCv(id),
dyids = content.match(/(?<=t.bilibili.com\/)[0-9]+/g) || [],
dyids_set = [...new Set(dyids)],
/**判断此专栏是否查看过的权重 */
@@ -349,7 +354,7 @@ class Searcher {
_weight = 0,
/**单个专栏中的dyid */
_dyinfos = [];
log.info('获取动态', `提取专栏(${cv})中提及的dyid(${length})`)
log.info('获取动态', `提取专栏(${id})中提及的dyid(${length})`)
/**遍历某专栏中的dyids */
for (const dyid of dyids_set) {
+6 -4
View File
@@ -95,6 +95,11 @@ const config = {
*/
article_scan_page: 3,
/**
* - 专栏创建时间距离现在的最大天数
*/
article_create_time: 7,
/**
* - 不检查专栏是否看过,若选择检查可以提高检测效率
* - 默认false(检查)
@@ -335,10 +340,7 @@ const config = {
* @param {string} n
*/
updata(n) {
const new_config = this.raw_config()[`config_${n}`];
if (new_config) {
this.setObject(new_config)
}
this.setObject(this.raw_config()[`config_${n}`])
},
init() {
+7 -2
View File
@@ -453,7 +453,7 @@ const bili_client = {
/**
* 搜索专栏
* @param {string} keyword
* @return {Promise<Array<number>>}
* @return {Promise<Array<{pub_time: number, id: number}>>}
*/
async searchArticlesByKeyword(keyword) {
const
@@ -471,7 +471,12 @@ const bili_client = {
let cv_arr = [];
try {
log.info('搜索专栏', '成功 关键词: ' + keyword);
cv_arr = res.data.result.map(it => it.id);
cv_arr = res.data.result.map(it => {
return {
pub_time: it.pub_time,
id: it.id
}
});
} catch (error) {
log.error('搜索专栏', '失败 原因:\n' + responseText);
cv_arr = [];
+5
View File
@@ -109,6 +109,11 @@ module.exports = Object.freeze({
*/
article_scan_page: 3,
/**
* - 专栏创建时间距离现在的最大天数
*/
article_create_time: 7,
/**
* - 不检查专栏是否看过,若选择检查可以提高检测效率
* - 默认false(检查)
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "lottery-auto-script",
"version": "2.3.2",
"version": "2.3.4",
"description": "自动参与B站动态抽奖",
"main": "main.js",
"scripts": {
@@ -52,4 +52,4 @@
"chalk": "^4.1.2",
"nodemailer": "^6.7.0"
}
}
}