-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhello.html
More file actions
90 lines (75 loc) · 2.71 KB
/
hello.html
File metadata and controls
90 lines (75 loc) · 2.71 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
let req_query = new URL(request.url).searchParams.get('q')
if (req_query == null) {
const reply = {
"status": "failed",
"message": "Send with an url query"
};
return new Response(JSON.stringify(reply), {
headers: {
"content-type": "application/json",
},
})
} else {
var id = req_query.split("/").pop()
}
var result = await fetch(`https://gwapi.zee5.com/content/details/${id}?translation=en&country=IN&version=2`, {
headers: {
"x-access-token": await token(),
'Content-Type': 'application/json'
}
})
var result = await result.json()
const error_msg = {
"status": "failed",
"message": "Invalid URL"
}
if (result.title == undefined || result.image_url == undefined) {
return new Response(JSON.stringify(error_msg), {
status: 400,
headers: ({
"Content-Type": "application/json",
})
})
} else {
var pass = ({
title: result.title,
image: result.image_url,
description: result.description,
hls: `https://zee5vodnd.akamaized.net${result.hls[0].replace("drm", "hls")}${await token()}`
})
res_data = {
"title": pass.title,
"description": pass.description,
"thumbnail": pass.image,
"Video_URL": pass.hls
}
return new Response(await JSON.stringify(res_data), {
status: 200,
headers: ({
"Content-Type": "application/json",
})
})
}
}
async function token() {
var token = await fetch('https://useraction.zee5.com/tokennd/')
var token = await token.json()
return token.video_token
}
</script>
</body>
</html>