From 6d56fe86382ec1f1fe20bdb98877546a146c3925 Mon Sep 17 00:00:00 2001 From: satori Date: Wed, 25 Dec 2024 17:12:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=84=E7=90=86=E6=94=B6=E8=97=8F=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/main.js b/main.js index 810e137..961ad7e 100644 --- a/main.js +++ b/main.js @@ -58,7 +58,8 @@ const 日期格式 = new Intl.DateTimeFormat('zh-CN', { // 匹配文章和截图的正则表达式 const imagesRegex = /\/web\/v1\/images\/detail\/v2\?imagesId=(\d+)¤tUserId=(\d+)/ const articleRegex = /\/web\/v1\/article\/get\?id=(\d+)&userId=(\d+)/ -const collectionRegex = /\/web\/v1\/member\/explorer\/article\/get\?id=(\d+)/ +const collectionArticleRegex = /\/web\/v1\/member\/explorer\/article\/get\?id=(\d+)/ +const collectionImagesRegex = /\/web\/v1\/member\/explorer\/get\?id=(\d+)/ var 当前日期 = 日期格式.format(new Date()).replace(/\//g, '-') @@ -175,9 +176,22 @@ export function main() { return } - // 处理收藏日志 + // 处理收藏图集日志 if (item.request.uri.startsWith('/web/v1/member/explorer/article/get')) { - const [uri, id] = item.request.uri.match(collectionRegex) ?? [] + const [uri, id] = item.request.uri.match(collectionArticleRegex) ?? [] + if (uri && id) { + 收藏.浏览数.日.set(id, (收藏.浏览数.日.get(id) || 0) + 1) + 收藏.浏览数.周.set(id, (收藏.浏览数.周.get(id) || 0) + 1) + 收藏.浏览数.月.set(id, (收藏.浏览数.月.get(id) || 0) + 1) + 收藏.浏览数.年.set(id, (收藏.浏览数.年.get(id) || 0) + 1) + 收藏.浏览数.总.set(id, (收藏.浏览数.总.get(id) || 0) + 1) + } + return + } + + // 处理收藏图片日志 + if (item.request.uri.startsWith('/web/v1/member/explorer/get')) { + const [uri, id] = item.request.uri.match(collectionImagesRegex) ?? [] if (uri && id) { 收藏.浏览数.日.set(id, (收藏.浏览数.日.get(id) || 0) + 1) 收藏.浏览数.周.set(id, (收藏.浏览数.周.get(id) || 0) + 1)