Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #141

Closed
wants to merge 23 commits into from
Closed

Dev #141

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
503 changes: 100 additions & 403 deletions package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@
"express": "^4.18.2",
"helmet": "^6.0.1",
"morgan": "^1.10.0",
"puppeteer": "^19.4.1",
"ts-node": "^10.9.1",
"underscore": "^1.13.6",
"unpacker": "^1.0.1"
},
"devDependencies": {
"@commitlint/config-conventional": "^17.4.4",
"@tsconfig/recommended": "^1.0.2",
"@types/cors": "^2.8.17",
"@types/express": "^4.17.17",
"@types/jest": "^29.5.0",
"@types/morgan": "^1.9.4",
Expand All @@ -71,6 +71,7 @@
"prettier": "^3.0.3",
"pretty": "^2.0.0",
"ts-jest": "^29.1.0",
"tsconfig-paths": "^4.2.0",
"tslib": "^2.5.0",
"typescript": "^4.9.5"
}
Expand Down
46 changes: 29 additions & 17 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,33 @@ import express from "express";
import morgan from "morgan";
import index from "./routes/app";
import providersList from "./routes/providers";
import flv from "./routes/v1/anime/animeflv/AnimeflvRoutes";
import latinhd from "./routes/v1/anime/animelatinohd/AnimeLatinoHDRoutes";
import gogoanime from "./routes/v1/anime/gogoanime/GogoAnimeRoute";
import zoro from "./routes/v1/anime/zoro/ZoroRoutes";
import monoschinos from "./routes/v1/anime/monoschinos/MonosChinosRoute";
import tioanime from './routes/v1/anime/tioanime/TioAnimeRoute'
import comick from "./routes/v1/manga/comick/ComickRoutes";

import inmanga from "./routes/v1/manga/inmanga/InmangaRoutes";
import nhentai from "./routes/v1/manga/nhentai/NhentaiRoutes"
import mangareader from "./routes/v1/manga/mangareader/MangaReaderRoutes";
import manganelo from "./routes/v1/manga/manganelo/ManganeloRoutes";
import helmet from "helmet";
import cors from 'cors'
import WcoStream from "./routes/v1/anime/wcostream/wcostreamRoutes";


/* Anime */
import flv from "@routes/anime/animeflv/AnimeflvRoutes";
import latinhd from "@routes/anime/animelatinohd/AnimeLatinoHDRoutes";
import gogoanime from "@routes/anime/gogoanime/GogoAnimeRoute";
import zoro from "@routes/anime/zoro/ZoroRoutes";
import monoschinos from "@routes/anime/monoschinos/MonosChinosRoute";
import tioanime from '@routes/anime/tioanime/TioAnimeRoute'
import WcoStream from "@routes/anime/wcostream/wcostreamRoutes";
import AnimeBlix from "@routes/anime/animeblix/AnimeBlixRoutes";

/* Manga */
import comick from "@routes/manga/comick/ComickRoutes";
import inmanga from "@routes/manga/inmanga/InmangaRoutes";
import nhentai from "@routes/manga/nhentai/NhentaiRoutes"
import mangareader from "@routes/manga/mangareader/MangaReaderRoutes";
import manganelo from "@routes/manga/manganelo/ManganeloRoutes";

const app = express();
const port = process.env.PORT || 3000;

app.use(index);
app.use(providersList);

//config
app.use(express.json());
app.use(express.urlencoded({ extended: false }));
Expand All @@ -31,24 +38,28 @@ app.use(cors())

//routes

/*anime*/
/* anime */

app.use(flv);
app.use(latinhd);
app.use(gogoanime);
app.use(monoschinos);
app.use(zoro);
app.use(tioanime)
app.use(WcoStream);
/*anime*/
app.use(AnimeBlix);

/* anime */

/* Manga */

/*Manga*/
app.use(comick);
app.use(inmanga);
app.use(nhentai)
app.use(mangareader);
app.use(manganelo);
/*Manga*/

/* Manga */


/*error */
Expand All @@ -60,6 +71,7 @@ interface ErrorResponse {
};
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
app.use((err, res, _next) => {
//console.log(err.statusCode);
let response: ErrorResponse;
Expand Down
31 changes: 31 additions & 0 deletions src/routes/v1/anime/animeblix/AnimeBlixRoutes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { Router } from "express";
import { AnimeBlix } from "../../../../scraper/sites/anime/AnimeBlix/AnimeBlix";
const Anime = new AnimeBlix();
const router = Router();

// Filter
router.get("/anime/animeblix/filter", async (req, res) => {
const { search, type, page, year, genre } = req.query

const data = await Anime.GetAnimeByFilter(search as string, type as unknown as number, page as unknown as number, year as string, genre as string)
res.send(data)
});

// Anime Info +(Episodes list)
router.get("/anime/animeblix/name/:name", async (req, res) => {

const { name } = req.params
const data = await Anime.GetAnimeInfo(name.includes("ver-")? name.replace("ver-","") : name)
res.send(data)

});

// Episode Info +(Video Servers)
router.get("/anime/animeblix/episode/:episode", async (req, res) => {
const { episode } = req.params
const data = await Anime.GetEpisodeServers(episode)
res.send(data)

});

export default router
2 changes: 1 addition & 1 deletion src/routes/v1/anime/animelatinohd/AnimeLatinoHDRoutes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Router } from "express";
import { AnimeLatinoHD } from "../../../../scraper/sites/anime/animelatinohd/AnimeLatinoHD";
import { AnimeLatinoHD } from "@providers/animelatinohd/AnimeLatinoHD";
const Anime = new AnimeLatinoHD();
const router = Router();

Expand Down
12 changes: 6 additions & 6 deletions src/routes/v1/anime/wcostream/wcostreamRoutes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Router } from "express";
import { WcoStream } from "../../../../scraper/sites/anime/wcostream/WcoStream";
import { WcoStream } from "@providers/wcostream/WcoStream";
import { RuntimeUnpacked } from "@animetypes/utils";
const Anime = new WcoStream();
const router = Router();

Expand All @@ -25,14 +26,13 @@ router.get("/anime/wcostream/filter", async (req, res) => {
res.send(data)
})

/*
Global API
*/

router.post("/runtime/unpacked", async (req,res) => {
const {base64} = req.body
const data = await Anime.RuntimeUnpacked(base64)
const {base64,unBuffer} = req.body
const data = await RuntimeUnpacked(base64,unBuffer)
return res.send(data)
})



export default router
2 changes: 1 addition & 1 deletion src/routes/v1/manga/comick/ComickRoutes.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Router } from "express";
import { Comick } from "../../../../scraper/sites/manga/comick/Comick";
import { Comick } from "@providers/comick/Comick";
const Manga = new Comick();
const router = Router();

Expand Down
4 changes: 2 additions & 2 deletions src/routes/v1/manga/inmanga/InmangaRoutes.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Router } from "express";
import { Inmanga } from "../../../../scraper/sites/manga/inmanga/Inmanga";
import { Inmanga } from "@providers/inmanga/Inmanga";
const Manga = new Inmanga();
const router = Router();


router.get("/manga/inmanga/filter", async (req, res) => {
const { search, type, genre } = req.query;
const data = await Manga.GetMangaByFilter(search as string, type as unknown as number, genre as string[]);
const data = await Manga.GetMangaByFilter(search as string, type as unknown as number, genre as []);

res.send(data)
});
Expand Down
182 changes: 182 additions & 0 deletions src/scraper/sites/anime/AnimeBlix/AnimeBlix.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
import * as cheerio from "cheerio";
import axios from "axios";
import { Anime } from "@animetypes/anime";
import { Episode, EpisodeServer } from "@animetypes/episode";
import { AnimeSearch, ResultSearch, IResultSearch, IAnimeSearch } from "@animetypes/search";
//import { Calendar } from "@animetypes/date";

/** List of Domains
* https://vwv.animeblix.org
*
* https://animeblix.xyz
*
* https://animeblix.com
*
*/

export class AnimeBlix {
readonly url = "https://vwv.animeblix.org";
readonly api = "https://api.animelatinohd.com";

async GetAnimeInfo(anime: string): Promise<Anime> {
try {
const { data } = await axios.get(`${this.url}/animes/${anime.includes("ver-") ? anime : "ver-"+anime}`);
const $ = cheerio.load(data);

const AnimeTypes = $(".cn .info .r .u li span:contains('Tipo:')").next()
const AnimeStatus = $(".cn .info .r .u li span[class='em']").length ? $(".cn .info .r .u li span[class='em']").text() : $(".cn .info .r .u li span[class='fi']").length ? $(".cn .info .r .u li span[class='fi']").text() : $(".cn .info .r .u li span[class='es']").text()
const AnimeDate = $(".cn .info .r .u li span:contains('Fecha de emisión:')").next().text().trim().replace(" -", "").split(" ")

const Dates = AnimeDate[0] ? new Date(String(AnimeDate[0])) : null
const DateFormat = new Intl.DateTimeFormat("en", { day: "numeric", month: "numeric", year: "numeric" }).format(Dates).split("/")


const AcceptAlts = $(".cn .info .r .u").next().find("li").text().replace("Nombre original: ", "").replace("Nombre en inglés: ", "---").replace("Nombre en japones: ", "---")

let AltsSlice: number = 0

if (AcceptAlts.includes("Támbien conocido como:")) {
AltsSlice = AcceptAlts.indexOf("Támbien conocido como:")
} else if (AcceptAlts.includes("Estudio(s):")) {
AltsSlice = AcceptAlts.indexOf("Estudio(s):")
} else if (AcceptAlts.includes("Producido por:")) {
AltsSlice = AcceptAlts.indexOf("Producido por:")
} else if (AcceptAlts.includes("Licenciada por:")) {
AltsSlice = AcceptAlts.indexOf("Licenciada por:")
}

const AltNames = AcceptAlts.slice(0, AltsSlice)
const AnimeInfo: Anime = {
name: $(".cn .ti h1 strong").text(),
url: `/anime/animeblix/name/${anime}`,
synopsis: $(".cn .info .r .tx .content p").first().text(),
alt_name: [...AltNames.split("---")],
image: {
url: $(".cn .info .l .i img").attr("data-src")
},
genres: [...$(".cn .info .r .gn li").text().split(",")],
type: AnimeTypes.length ? AnimeTypes.text() == "TV" ? "Anime" : AnimeTypes.text() == "Pelicula" ? "Movie" : AnimeTypes.text() == "Ova" ? "OVA" : "Null" : "Null", //tv,pelicula,especial,ova
status: AnimeStatus,
date: AnimeDate[0] ? { year: DateFormat[2], month: DateFormat[1], day: DateFormat[0] } : null,
episodes: []
}

const ListEpisodeIndex = $(".sc .cn #l").html()
const RemoveSymbols: RegExp = /[^0-9,]+/g;
const ReplaceSymbols: RegExp = /(,)+/g;
const ListEpisode = ListEpisodeIndex.slice(ListEpisodeIndex.indexOf("var eps = "), ListEpisodeIndex.indexOf(";</") - 1).replace(RemoveSymbols, "").replace(ReplaceSymbols, ",").slice(0, ListEpisodeIndex.lastIndexOf(",", -1)).split(",")

ListEpisode.map((e) => {
const AnimeEpisode: Episode = {
name: "Episode " +e,
number: e,
image: "",
url: `/anime/animeblix/episode/${anime+"-"+e}`
}

AnimeInfo.episodes.push(AnimeEpisode);
})

return AnimeInfo;

} catch (error) {
console.log(error)
}
}
async GetEpisodeServers(episode: string): Promise<Episode> {
try {

const number = episode.substring(episode.lastIndexOf("-") + 1)
const anime = episode.substring(0, episode.lastIndexOf("-"))

const { data } = await axios.get(`${this.url}/${anime.replace("ver-","")}-${number}`);
const $ = cheerio.load(data);
fetch("https://vwv.animeblix.org/back", {
"headers": {
"accept": "*/*",
"accept-language": "es-419,es;q=0.9,es-ES;q=0.8,en;q=0.7,en-GB;q=0.6,en-US;q=0.5",
"content-type": "application/x-www-form-urlencoded; charset=UTF-8",
"sec-ch-ua": "\"Not A(Brand\";v=\"99\", \"Microsoft Edge\";v=\"121\", \"Chromium\";v=\"121\"",
"sec-ch-ua-mobile": "?0",
"sec-ch-ua-platform": "\"Windows\"",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"sec-fetch-site": "same-origin",
"x-requested-with": "XMLHttpRequest",
"cookie": "dom3ic8zudi28v8lr6fgphwffqoz0j6c=85632e4b-e8b5-4427-be7b-8b3c7156a788%3A1%3A1; sb_main_47d33eb2af15845dedc4fb60a160b2b4=1; sb_count_47d33eb2af15845dedc4fb60a160b2b4=2; sb_onpage_47d33eb2af15845dedc4fb60a160b2b4=0; sb_page_47d33eb2af15845dedc4fb60a160b2b4=7; pp_main_325f99fa973f521d38ec7eea8396403e=1; pp_sub_325f99fa973f521d38ec7eea8396403e=1",

"Referrer-Policy": "strict-origin-when-cross-origin"
},
"body": "acc=opt&i=333334322d3132",
"method": "POST"
}).then((e) =>e).then(async(e) =>console.log(await e.text()));

const AnimeEpisodeInfo: Episode = {
name: number,
url: `/anime/animeblix/episode/${episode}`,
number: number,
image: "",
servers: []
}


$("").map((e) => {

const Server: EpisodeServer = {
name: "e.server.title",
url: "",
}

Server.url = "https://api.animelatinohd.com/stream/"
Server.name = String(e)

AnimeEpisodeInfo.servers.push(Server)
})

return AnimeEpisodeInfo;
} catch (error) {
console.log(error)
}
}

async GetAnimeByFilter(search?: string, type?: number, page?: number, year?: string, genre?: string): Promise<IResultSearch<IAnimeSearch>> {
try {
const { data } = await axios.get(`${this.api}/api/anime/list`, {
params: {
search: search,
type: type,
year: year,
genre: genre,
page: page
}
});

const animeSearchParseObj = data

const animeSearch: ResultSearch<IAnimeSearch> = {
nav: {
count: animeSearchParseObj.data.length,
current: animeSearchParseObj.current_page,
next: animeSearchParseObj.data.length < 28 ? 0 : animeSearchParseObj.current_page + 1,
hasNext: animeSearchParseObj.data.length < 28 ? false : true
},
results: []
}
animeSearchParseObj.data.map(e => {
const animeSearchData: AnimeSearch = {
name: e.name,
image: "https://www.themoviedb.org/t/p/original" + e.poster + "?&w=53&q=95",
url: `/anime/animelatinohd/name/${e.slug}`,
type: ""
}
animeSearch.results.push(animeSearchData)
})
return animeSearch;
} catch (error) {
console.log(error)
}
}

}


Loading
Loading