From 65bb0d244d8a07c1c67b95eb440b634759f5be2c Mon Sep 17 00:00:00 2001 From: UCPr Date: Sat, 16 Aug 2025 18:49:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=BApicacg=E6=8E=A2=E7=B4=A2?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=B7=BB=E5=8A=A0=E6=97=A5=E6=A6=9C=E3=80=81?= =?UTF-8?q?=E5=91=A8=E6=A6=9C=E3=80=81=E6=9C=88=E6=A6=9C=20(#128)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: 为picacg探索页面添加日榜、周榜、月榜 * Update index.json --- index.json | 2 +- picacg.js | 103 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 102 insertions(+), 3 deletions(-) diff --git a/index.json b/index.json index 71b976b..5a24b9b 100644 --- a/index.json +++ b/index.json @@ -21,7 +21,7 @@ "name": "Picacg", "fileName": "picacg.js", "key": "picacg", - "version": "1.0.3" + "version": "1.0.5" }, { "name": "nhentai", diff --git a/picacg.js b/picacg.js index f29b4bd..b8d6f65 100644 --- a/picacg.js +++ b/picacg.js @@ -3,7 +3,7 @@ class Picacg extends ComicSource { key = "picacg" - version = "1.0.4" + version = "1.0.5" minAppVersion = "1.0.0" @@ -164,6 +164,99 @@ class Picacg extends ComicSource { comics: comics } } + }, + { + title: "Picacg H24", + type: "multiPageComicList", + load: async (page) => { + if (!this.isLogged) { + throw 'Not logged in' + } + let res = await Network.get( + `${this.loadSetting('base_url')}/comics/leaderboard?tt=H24&ct=VC`, + this.buildHeaders('GET', 'comics/leaderboard?tt=H24&ct=VC', this.loadData('token')) + ) + if (res.status === 401) { + await this.account.reLogin() + res = await Network.get( + `${this.loadSetting('base_url')}/comics/leaderboard?tt=H24&ct=VC`, + this.buildHeaders('GET', 'comics/leaderboard?tt=H24&ct=VC', this.loadData('token')) + ) + } + if (res.status !== 200) { + throw 'Invalid status code: ' + res.status + } + let data = JSON.parse(res.body) + let comics = [] + data.data.comics.forEach(c => { + comics.push(this.parseComic(c)) + }) + return { + comics: comics + } + } + }, + { + title: "Picacg D7", + type: "multiPageComicList", + load: async (page) => { + if (!this.isLogged) { + throw 'Not logged in' + } + let res = await Network.get( + `${this.loadSetting('base_url')}/comics/leaderboard?tt=D7&ct=VC`, + this.buildHeaders('GET', 'comics/leaderboard?tt=D7&ct=VC', this.loadData('token')) + ) + if (res.status === 401) { + await this.account.reLogin() + res = await Network.get( + `${this.loadSetting('base_url')}/comics/leaderboard?tt=D7&ct=VC`, + this.buildHeaders('GET', 'comics/leaderboard?tt=D7&ct=VC', this.loadData('token')) + ) + } + if (res.status !== 200) { + throw 'Invalid status code: ' + res.status + } + let data = JSON.parse(res.body) + let comics = [] + data.data.comics.forEach(c => { + comics.push(this.parseComic(c)) + }) + return { + comics: comics + } + } + }, + { + title: "Picacg D30", + type: "multiPageComicList", + load: async (page) => { + if (!this.isLogged) { + throw 'Not logged in' + } + let res = await Network.get( + `${this.loadSetting('base_url')}/comics/leaderboard?tt=D30&ct=VC`, + this.buildHeaders('GET', 'comics/leaderboard?tt=D30&ct=VC', this.loadData('token')) + ) + if (res.status === 401) { + await this.account.reLogin() + res = await Network.get( + `${this.loadSetting('base_url')}/comics/leaderboard?tt=D30&ct=VC`, + this.buildHeaders('GET', 'comics/leaderboard?tt=D30&ct=VC', this.loadData('token')) + ) + } + if (res.status !== 200) { + throw 'Invalid status code: ' + res.status + } + let data = JSON.parse(res.body) + let comics = [] + data.data.comics.forEach(c => { + comics.push(this.parseComic(c)) + }) + return { + comics: comics + } + } } ] @@ -691,6 +784,9 @@ class Picacg extends ComicSource { 'zh_CN': { 'Picacg Random': "哔咔随机", 'Picacg Latest': "哔咔最新", + 'Picacg H24': "哔咔日榜", + 'Picacg D7': "哔咔周榜", + 'Picacg D30': "哔咔月榜", 'New to old': "新到旧", 'Old to new': "旧到新", 'Most likes': "最多喜欢", @@ -710,6 +806,9 @@ class Picacg extends ComicSource { 'zh_TW': { 'Picacg Random': "哔咔隨機", 'Picacg Latest': "哔咔最新", + 'Picacg H24': "哔咔日榜", + 'Picacg D7': "哔咔周榜", + 'Picacg D30': "哔咔月榜", 'New to old': "新到舊", 'Old to new': "舊到新", 'Most likes': "最多喜歡", @@ -727,4 +826,4 @@ class Picacg extends ComicSource { 'Sort': "排序", }, } -} \ No newline at end of file +}