From 0d6b3820b4eaa818325836483cbff48eb325c2fb Mon Sep 17 00:00:00 2001 From: MiaoMint <44718819+MiaoMint@users.noreply.github.com> Date: Fri, 22 Sep 2023 23:22:11 +0800 Subject: [PATCH] fix: `me.mikanan.js` search (#46) * Create me.mikanan.js * fix: language errer * fix: `me.mikanan.js` search --- repo/me.mikanan.js | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/repo/me.mikanan.js b/repo/me.mikanan.js index c517044..5f40e59 100644 --- a/repo/me.mikanan.js +++ b/repo/me.mikanan.js @@ -96,12 +96,10 @@ export default class extends Extension { }; } - async latest(page) { + async getData(year, season) { await this.getDate(); - const currentYear = new Date().getFullYear(); - const season = this.date[new Date().getFullYear()][0]; const res = await this.req( - `/Home/BangumiCoverFlowByDayOfWeek?year=${currentYear}&seasonStr=${season}` + `/Home/BangumiCoverFlowByDayOfWeek?year=${year}&seasonStr=${season}` ); const bangumi = []; const lis = await this.querySelectorAll(res, ".sk-bangumi li"); @@ -122,6 +120,13 @@ export default class extends Extension { return bangumi; } + async latest(page) { + await this.getDate(); + const currentYear = new Date().getFullYear(); + const season = this.date[new Date().getFullYear()][0]; + return this.getData(currentYear, season); + } + async detail(url) { const res = await this.req(`${url}`); const cover = await this.getFullUrl( @@ -179,7 +184,10 @@ export default class extends Extension { } async search(kw, page, filter) { - throw Error("不支持搜索,请使用筛选"); + if (!filter) { + return await this.latest() + } + return await this.getData(filter.year, filter.season) } async watch(url) {