Skip to content

Commit

Permalink
pref: me.mikanani.js (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
MiaoMint authored Sep 24, 2023
1 parent 5e7a998 commit 473ba91
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions repo/me.mikanani.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==MiruExtension==
// @name Mikanani
// @version v0.0.2
// @version v0.0.3
// @author MiaoMint
// @lang zh-cn
// @license MIT
Expand Down Expand Up @@ -152,28 +152,28 @@ export default class extends Extension {
});
}

const episodeGrups = [];

for (const item of subtitleGrups) {
const res = await this.req(
`/Home/ExpandEpisodeTable?bangumiId=${bangumiId}&subtitleGroupId=${item.subtitleId}&take=999999`
);
const trs = await this.querySelectorAll(res, "tbody tr");
const episodes = [];
for (const item of trs) {
const html = item.content;
const name = await this.querySelector(html, "a").text;
const url = html.match(/\/Download\/.*\.torrent/)[0];
episodes.push({
name,
url,
});
}
episodeGrups.push({
title: item.name,
urls: episodes,
});
}
const episodeGrups = await Promise.all(
subtitleGrups.map(async (item) => {
const res = await this.req(
`/Home/ExpandEpisodeTable?bangumiId=${bangumiId}&subtitleGroupId=${item.subtitleId}&take=999999`
);
const trs = await this.querySelectorAll(res, "tbody tr");
const episodes = [];
for (const item of trs) {
const html = item.content;
const name = await this.querySelector(html, "a").text;
const url = html.match(/\/Download\/.*\.torrent/)[0];
episodes.push({
name,
url,
});
}
return {
title: item.name,
urls: episodes,
};
})
);

return {
title,
Expand All @@ -185,9 +185,9 @@ export default class extends Extension {

async search(kw, page, filter) {
if (!filter) {
return await this.latest()
return await this.latest();
}
return await this.getData(filter.year, filter.season)
return await this.getData(filter.year, filter.season);
}

async watch(url) {
Expand Down

0 comments on commit 473ba91

Please sign in to comment.