Skip to content
This repository has been archived by the owner on Jul 14, 2024. It is now read-only.

Commit

Permalink
Updating shorts things
Browse files Browse the repository at this point in the history
  • Loading branch information
garder500 committed Jun 11, 2024
1 parent c368800 commit 59fcb19
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions src/store/animes.store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,15 @@ export class AnimeStore {
const responseVF = await axios.get(vfUrl);
if(Array.isArray(responseVostfr.data) && Array.isArray(responseVF.data)){

this.vostfr = responseVostfr.data;
this.vf = responseVF.data;
this.all = [...this.vostfr, ...this.vf].map(({ url_image, coverUrl, ...anime}) => {
this.vostfr = responseVostfr.data.map(({ url_image, coverUrl, ...anime}) => {
return {
...anime,
coverUrl: "https://neko.ketsuna.com/"+coverUrl,
url_image: "https://neko.ketsuna.com/"+url_image,
coverUrl: "https://neko.ketsuna.com"+coverUrl,
url_image: "https://neko.ketsuna.com"+url_image,
};
});
this.vf = responseVF.data;
this.all = [...this.vostfr, ...this.vf]
}else{
console.log("Problem occured while retrieving data from the server.")
}
Expand All @@ -65,7 +65,13 @@ export class AnimeStore {
let latestEpisodes: LatestEpisode[] = [];
if (parsedData) latestEpisodes = JSON.parse(parsedData[1]);

this.latest = latestEpisodes;
this.latest = latestEpisodes.map(({url_bg, url_image, ...episode}) => {
return {
...episode,
url_image: "https://neko.ketsuna.com"+url_image,
url_bg: "https://neko.ketsuna.com"+url_bg,
}
});
}

/* This function converts a string representing an episode
Expand All @@ -82,12 +88,10 @@ export class AnimeStore {
if (!anime) return Promise.resolve(undefined);

const { data: animeHtml } = await axios.get(`https://neko.ketsuna.com/${anime.url.replace("https://neko-sama.fr/", "")}`);
console.log(anime.url);
const synopsis = /(<div class="synopsis">\n<p>\n)(.*)/gm.exec(animeHtml)?.[2];
const coverUrl = /(<div id="head" style="background-image: url\()(.*)(\);)/gm.exec(animeHtml)?.[2];
const episodes = load(animeHtml)(".episodes .col-xs-12").map((i, el) => {
const episode = load(el);
console.log(episode("a").text());
const episodeNumber = episode("a").text().trimEnd().split(" - ");
return {
title: episode("a").text().trimEnd().trimStart(),
Expand All @@ -96,7 +100,7 @@ export class AnimeStore {
time: "24:00",
// to get the correct episode number we need to extract this from the text : "title - 01 VOSTFR - 01" // here we need to extract the last number
episode: episodeNumber[episodeNumber.length - 1],
url_image: "https://neko.ketsuna.com/"+ coverUrl as string,
url_image: "https://neko.ketsuna.com"+ coverUrl as string,
m3u8: "",
};
}).get();
Expand Down

0 comments on commit 59fcb19

Please sign in to comment.