first commit

This commit is contained in:
Inside4ndroid
2024-06-23 19:03:01 +01:00
commit ffb4811dee
7 changed files with 1576 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
import express from "express";
import { getVidsrcSourcesId, getVidsrctoStreams } from "./src/vidsrcto.js";
import { port } from "./src/constants.js";
const app = express()
app.get('/', (req, res) => {
res.status(200).json({
intro: "Welcome to the unofficial vidsrc provider: check the provider website @ https://vidsrc.to/ ",
routes: {
movie: "/vidsrc/:movieTMDBid",
show: "/vidsrc/:showTMDBid?s=seasonNumber&e=episodeNumber"
},
author: "This api is developed and created by AijaZ"
});
});
app.get('/vidsrc/:tmdbId', async (req, res) => {
const id = req.params.tmdbId;
const season = req.query.s;
const episode = req.query.e;
const sourcesId = await getVidsrcSourcesId(id, season, episode);
const response = await getVidsrctoStreams(sourcesId);
const responseData = response.data;
if (responseData.file === null) {
res.status(404).send({
status: 404,
return: "Oops reached rate limit of this api"
})
} else {
res.status(200).json([response]);
}
});
app.listen(port, () => {
console.log(`Example app listening on port http://localhost:${port}`);
});