Public
HTTP (deprecated)
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/** @jsxImportSource npm:hono@3/jsx */
import { doodstream, format, streamwish } from "https://esm.town/v/tempguy/redMonkey";
import { Hono } from "npm:hono";
const app = new Hono();
app.get("/embed/:id/:ep/:dub", async (c) => {
const id = c.req.param("id");
const ep = Number(c.req.param("ep"));
const dub = c.req.param("dub") === "dub";
const results = [];
const metaResponse = await fetch(
`https://cool-proxy.koyeb.app/hdiuhmalkmc9d0ck7UCFVGBJHN?destination=https://api.malsync.moe/mal/anime/${id}`,
);
const metaData = await metaResponse.json();
const GOGO = metaData.Sites.Gogoanime;
console.log(metaData);
const watchID = Object.values(GOGO).flatMap((data) => {
const isDub = data.identifier.includes("dub");
console.log(data.identifier);
if (dub && isDub || !dub && !isDub) {
const episodeIdentifier = `${data.identifier}-episode-${ep}`;
return [
fetch(`https://animetize-api.vercel.app/servers/${episodeIdentifier}`),
fetch(`https://animetize-api.vercel.app/watch/${episodeIdentifier}`),
];
}
return [];
});
console.log(watchID);
const [baseResponse, mainResponse] = await Promise.all(watchID);
const baseData = await baseResponse.json();
const mainData = await mainResponse.json();
await Promise.all(
mainData.sources.map(async (data) => {
if (data.quality === "default" || data.quality === "backup") {
results.push(await format(data.url));
}
}),
);
await Promise.all(
baseData.map(async (data) => {
const _ = data.url.split("/")[4];
switch (data.name) {
// case "Streamwish":
// results.push(await streamwish({ url: "https://streamwish.to/" + _ }));
// break;
// case "Doodstream":
// results.push(await doodstream({ url: "https://d000d.com/e/" + _ }));
// break;
case "Vidhide":
// Uncomment if Vidhide logic is needed
// results.push(await streamwish({ url: "https://vidhidepro.com/v/" + _ }));
break;
}
}),
);
return c.html(`
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>${metaData.title}</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@300;700&display=swap');
html,
body {
font-family: 'Lexend';
margin: 0;
padding: 0;
height: 100%;
width: 100%;
overflow: hidden;
font-family: sans-serif;
background: #090909;
color: #ddd;
position: relative;
}
#server-select-server {
position: absolute;
top: 5px;
left: 5px;
padding: 5px;
}
select {
background: #FFF;
color: #000;
border: 2px solid black;
border-radius: 7px;
z-index: 100;
}
#player {
tempdev-anime.web.val.run
September 1, 2024