-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3284ffe
commit 425a741
Showing
18 changed files
with
207 additions
and
229 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,181 +1,148 @@ | ||
/* import { getHTML } from "./assets/getHTML"; | ||
import { getHTML } from "./assets/getHTML"; | ||
import { Anime } from "../../../../types/anime"; | ||
import { getAllAnimes } from "./assets/getAllAnimesHTML"; | ||
import { Episode } from "../../../../types/episode"; | ||
|
||
//This is a class | ||
export class GogoanimeInfo { | ||
async getAnimeInfo(animeName: string) { | ||
try { | ||
const $ = await getHTML(`https://www3.gogoanimes.fi/category/${animeName}`); | ||
const anime = new Anime; | ||
anime.genres = []; | ||
anime.name = $("div.anime_info_body_bg h1").text(); | ||
anime.image = { | ||
url: $("div.anime_info_body_bg ").find("img").attr("src") | ||
} | ||
anime.alt_name = $("div.anime_info_body_bg"). | ||
find("p"). | ||
last(). | ||
text(). | ||
replace("Other name: ", ""). | ||
trim(); | ||
$("div.anime_info_body_bg p.type a").each((iterator, elementHTML) => { | ||
if (iterator) | ||
anime.genres.push($(elementHTML).html()); | ||
}) | ||
$('div.anime_info_body_bg p.type').each((index, element) => { | ||
//Skips for first p.type | ||
if (index) | ||
if (index == 1) { | ||
anime.synopsis = $(element).text().replace('Plot Summary: ', '').trim(); | ||
} | ||
if (index == 4 && $(element).text().trim() != 'Status: ') { | ||
try { | ||
const $ = await getHTML( | ||
`https://www3.gogoanimes.fi/category/${animeName}` | ||
); | ||
|
||
const anime = new Anime(); | ||
|
||
anime.genres = []; | ||
|
||
anime.name = $("div.anime_info_body_bg h1").text(); | ||
|
||
anime.image = { | ||
url: $("div.anime_info_body_bg ").find("img").attr("src"), | ||
}; | ||
|
||
anime.alt_name = $("div.anime_info_body_bg") | ||
.find("p") | ||
.last() | ||
.text() | ||
.replace("Other name: ", "") | ||
.trim(); | ||
|
||
$("div.anime_info_body_bg p.type a").each((iterator, elementHTML) => { | ||
if (iterator) anime.genres.push($(elementHTML).html()); | ||
}); | ||
|
||
$("div.anime_info_body_bg p.type").each((index, element) => { | ||
//Skips for first p.type | ||
if (index) | ||
if (index == 1) { | ||
anime.synopsis = $(element) | ||
.text() | ||
.replace("Plot Summary: ", "") | ||
.trim(); | ||
} | ||
|
||
if (index == 4 && $(element).text().trim() != "Status: ") { | ||
anime.status = true; | ||
} | ||
if (index == 5) { | ||
anime.alt_name = $(element).text().trim() | ||
.replace('Other name:', '') | ||
.replace(/\s/g, '') | ||
} | ||
}) | ||
|
||
if (index == 5) { | ||
anime.alt_name = $(element) | ||
.text() | ||
.trim() | ||
.replace("Other name:", "") | ||
.replace(/\s/g, ""); | ||
} | ||
}); | ||
|
||
let getNumberEpisodes: any = $('#episode_page li').last().text().trim().split("-")[1]; | ||
getNumberEpisodes = parseInt(getNumberEpisodes); | ||
let getNumberEpisodes: any = $("#episode_page li") | ||
.last() | ||
.text() | ||
.trim() | ||
.split("-")[1]; | ||
getNumberEpisodes = parseInt(getNumberEpisodes); | ||
|
||
for (let index = 1; index <= getNumberEpisodes; index++) { | ||
anime.episodes.push({ | ||
for (let index = 1; index <= getNumberEpisodes; index++) { | ||
anime.episodes.push({ | ||
name: `${animeName}-cap-${index}`, | ||
url: `/anime/gogoanime/episode/${animeName}/${index}`,//sorry for the change | ||
url: `/anime/gogoanime/episode/${animeName}/${index}`, //sorry for the change | ||
number: `${index}`, | ||
image: "That isn't image" | ||
}) | ||
} | ||
return anime | ||
image: "That isn't image", | ||
}); | ||
} | ||
|
||
} catch(error) { | ||
return anime; | ||
} catch (error) { | ||
return error; | ||
} | ||
} | ||
} | ||
|
||
export class GogoanimeFilter { | ||
async getAnimesfilterByGenre(genre: string, numPage: number) { | ||
let animesByGenre = await getAllAnimes( | ||
`https://www3.gogoanimes.fi/genre/${genre}`, | ||
numPage | ||
); | ||
|
||
async getAnimesfilterByGenre(genre: string, numPage: number) { | ||
let animesByGenre = await getAllAnimes( | ||
`https://www3.gogoanimes.fi/genre/${genre}`, numPage | ||
) | ||
return animesByGenre; | ||
} | ||
async filterBySeasons( season: string, year: string, numPage: number ) { | ||
return animesByGenre; | ||
} | ||
|
||
async filterBySeasons(season: string, year: string, numPage: number) { | ||
let animes = await getAllAnimes( | ||
`https://www3.gogoanimes.fi/sub-category/${season}-${year}-anime`, numPage | ||
`https://www3.gogoanimes.fi/sub-category/${season}-${year}-anime`, | ||
numPage | ||
); | ||
|
||
return animes | ||
return animes; | ||
} | ||
} | ||
|
||
export class GogoanimeServer { | ||
async getAnimeServerEpisode(animeName: string, episodeNumber: number) { | ||
async getAnimeServerEpisode(animeName: string, episodeNumber: number) { | ||
let serverUrl: string; | ||
let serverName: string; | ||
|
||
const $ = await getHTML( | ||
`https://www3.gogoanimes.fi/${animeName}-episode-${episodeNumber}` | ||
`https://www3.gogoanimes.fi/${animeName}-episode-${episodeNumber}` | ||
); | ||
|
||
const episode = new Episode(); | ||
episode.name = "This isn't name"; | ||
episode.servers = []; | ||
$(".anime_muti_link ul li ").each((iterator, element) => { | ||
|
||
episode.name = "This isn't name"; | ||
episode.servers = []; | ||
|
||
if (iterator == 0 || iterator == 1){ | ||
serverName = $(element).find("a").text(). | ||
replace(" this server", "").trim(); | ||
$(".anime_muti_link ul li ").each((iterator, element) => { | ||
if (iterator == 0 || iterator == 1) { | ||
serverName = $(element) | ||
.find("a") | ||
.text() | ||
.replace(" this server", "") | ||
.trim(); | ||
|
||
serverUrl = `http:${$(element).find("a").attr("data-video")}`; | ||
|
||
episode.servers.push({ | ||
episode.servers.push({ | ||
name: serverName, | ||
url: serverUrl | ||
url: serverUrl, | ||
}); | ||
}if(iterator > 2) { | ||
serverName = $(element).find("a").text(). | ||
replace(" this server", "").trim(); | ||
serverUrl = $(element).find("a").attr("data-video"); | ||
} | ||
if (iterator > 2) { | ||
serverName = $(element) | ||
.find("a") | ||
.text() | ||
.replace(" this server", "") | ||
.trim(); | ||
|
||
serverUrl = $(element).find("a").attr("data-video"); | ||
|
||
episode.servers.push({ | ||
episode.servers.push({ | ||
name: serverName, | ||
url: serverUrl | ||
url: serverUrl, | ||
}); | ||
} | ||
}) | ||
}); | ||
|
||
return episode; | ||
} | ||
} | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.