Skip to content

Commit

Permalink
fix: me.mikanan.js search (#46)
Browse files Browse the repository at this point in the history
* Create me.mikanan.js

* fix: language errer

* fix: `me.mikanan.js` search
  • Loading branch information
MiaoMint authored Sep 22, 2023
1 parent bad4395 commit 0d6b382
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions repo/me.mikanan.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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(
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 0d6b382

Please sign in to comment.