mirror of
https://github.com/sussy-code/smov.git
synced 2024-12-21 14:47:41 +01:00
feat(kissasian): additional mp4upload embed scraper
This commit is contained in:
parent
a0bb03790a
commit
bc0f9a6abf
1 changed files with 36 additions and 18 deletions
|
@ -5,6 +5,17 @@ import { MWMediaType } from "../metadata/types";
|
||||||
|
|
||||||
const kissasianBase = "https://kissasian.li";
|
const kissasianBase = "https://kissasian.li";
|
||||||
|
|
||||||
|
const embedProviders = [
|
||||||
|
{
|
||||||
|
type: MWEmbedType.MP4UPLOAD,
|
||||||
|
id: "mp",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: MWEmbedType.STREAMSB,
|
||||||
|
id: "sb",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
registerProvider({
|
registerProvider({
|
||||||
id: "kissasian",
|
id: "kissasian",
|
||||||
displayName: "KissAsian",
|
displayName: "KissAsian",
|
||||||
|
@ -65,37 +76,44 @@ registerProvider({
|
||||||
?.querySelector("td.episodeSub a")
|
?.querySelector("td.episodeSub a")
|
||||||
?.textContent?.split("Episode")[1]
|
?.textContent?.split("Episode")[1]
|
||||||
?.trim();
|
?.trim();
|
||||||
const href = ep?.querySelector("td.episodeSub a")?.getAttribute("href");
|
const url = ep?.querySelector("td.episodeSub a")?.getAttribute("href");
|
||||||
return { number, href };
|
return { number, url };
|
||||||
})
|
})
|
||||||
.filter((e) => !!e.href);
|
.filter((e) => !!e.url);
|
||||||
|
|
||||||
const targetEpisode =
|
const targetEpisode =
|
||||||
media.meta.type === MWMediaType.MOVIE
|
media.meta.type === MWMediaType.MOVIE
|
||||||
? episodes[0]
|
? episodes[0]
|
||||||
: episodes.find((e) => e.number === `${episodeNumber}`);
|
: episodes.find((e) => e.number === `${episodeNumber}`);
|
||||||
if (!targetEpisode?.href) throw new Error("Episode not found");
|
if (!targetEpisode?.url) throw new Error("Episode not found");
|
||||||
|
|
||||||
progress(70);
|
progress(70);
|
||||||
|
|
||||||
const watch = await proxiedFetch<any>(`${targetEpisode.href}&s=sb`, {
|
let embeds = await Promise.all(
|
||||||
baseURL: kissasianBase,
|
embedProviders.map(async (provider) => {
|
||||||
});
|
const watch = await proxiedFetch<any>(
|
||||||
|
`${targetEpisode.url}&s=${provider.id}`,
|
||||||
|
{
|
||||||
|
baseURL: kissasianBase,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
const watchPage = new DOMParser().parseFromString(watch, "text/html");
|
const watchPage = new DOMParser().parseFromString(watch, "text/html");
|
||||||
|
|
||||||
const streamsbUrl = watchPage
|
const embedUrl = watchPage
|
||||||
.querySelector("iframe[id=my_video_1]")
|
.querySelector("iframe[id=my_video_1]")
|
||||||
?.getAttribute("src");
|
?.getAttribute("src");
|
||||||
if (!streamsbUrl) throw new Error("Streamsb embed not found");
|
|
||||||
|
return {
|
||||||
|
type: provider.type,
|
||||||
|
url: embedUrl ?? "",
|
||||||
|
};
|
||||||
|
})
|
||||||
|
);
|
||||||
|
embeds = embeds.filter((e) => e.url !== "");
|
||||||
|
|
||||||
return {
|
return {
|
||||||
embeds: [
|
embeds,
|
||||||
{
|
|
||||||
type: MWEmbedType.STREAMSB,
|
|
||||||
url: streamsbUrl,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue