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)