diff --git a/lib/core/monitor.js b/lib/core/monitor.js index 9c53a4c..ef4667d 100644 --- a/lib/core/monitor.js +++ b/lib/core/monitor.js @@ -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({ diff --git a/lib/core/searcher.js b/lib/core/searcher.js index 52531e3..0e39f8d 100644 --- a/lib/core/searcher.js +++ b/lib/core/searcher.js @@ -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,13 @@ class Searcher { /**存储所有专栏中的dyid */ let dyinfos = []; /**遍历专栏s */ - for (const cv of cvs) { + for (const { id, pub_time } of cvs) { + if (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 +353,7 @@ class Searcher { _weight = 0, /**单个专栏中的dyid */ _dyinfos = []; - log.info('获取动态', `提取专栏(${cv})中提及的dyid(${length})`) + log.info('获取动态', `提取专栏(${id})中提及的dyid(${length})`) /**遍历某专栏中的dyids */ for (const dyid of dyids_set) { diff --git a/lib/data/config.js b/lib/data/config.js index 7775f4b..3e45f2e 100644 --- a/lib/data/config.js +++ b/lib/data/config.js @@ -95,6 +95,11 @@ const config = { */ article_scan_page: 3, + /** + * - 专栏创建时间距离现在的最大天数 + */ + article_create_time: 7, + /** * - 不检查专栏是否看过,若选择检查可以提高检测效率 * - 默认false(检查) diff --git a/lib/net/bili.js b/lib/net/bili.js index ec51e73..b22ce5d 100644 --- a/lib/net/bili.js +++ b/lib/net/bili.js @@ -453,7 +453,7 @@ const bili_client = { /** * 搜索专栏 * @param {string} keyword - * @return {Promise>} + * @return {Promise>} */ 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 = []; diff --git a/my_config.example.js b/my_config.example.js index 514888e..6cca2e7 100644 --- a/my_config.example.js +++ b/my_config.example.js @@ -109,6 +109,11 @@ module.exports = Object.freeze({ */ article_scan_page: 3, + /** + * - 专栏创建时间距离现在的最大天数 + */ + article_create_time: 7, + /** * - 不检查专栏是否看过,若选择检查可以提高检测效率 * - 默认false(检查)