Compare commits
3 Commits
a733118d35
...
142dff3a84
| Author | SHA1 | Date | |
|---|---|---|---|
| 142dff3a84 | |||
| 665727562d | |||
| 89a829dac0 |
@@ -0,0 +1,8 @@
|
|||||||
|
import { NextRequest } from "next/server"
|
||||||
|
|
||||||
|
export async function GET(request: NextRequest) {
|
||||||
|
const url = new URL(request.url)
|
||||||
|
const baseUrl = `${url.protocol}//${url.host}`
|
||||||
|
const response = await fetch(`${baseUrl}/iptv/sdlive-playlist.m3u8?id=1`)
|
||||||
|
return response
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import { NextRequest } from "next/server"
|
||||||
|
|
||||||
|
export async function GET(request: NextRequest) {
|
||||||
|
const url = new URL(request.url)
|
||||||
|
const baseUrl = `${url.protocol}//${url.host}`
|
||||||
|
const response = await fetch(`${baseUrl}/iptv/sdlive-playlist.m3u8?id=2`)
|
||||||
|
return response
|
||||||
|
}
|
||||||
@@ -1,18 +1,29 @@
|
|||||||
export async function GET(request: Request) {
|
import { addSdliveIdsToPlaylist } from "@/utils/iptv/addSdliveIdsToPlaylist"
|
||||||
const response = await fetch('https://sdlive-1-internal.d-ho.me/playlist.m3u8')
|
import { NextRequest } from "next/server"
|
||||||
|
|
||||||
if (!response.ok) {
|
export async function GET(request: NextRequest) {
|
||||||
return new Response('Failed to fetch playlist', { status: 500 })
|
const searchParams = request.nextUrl.searchParams
|
||||||
|
const id = searchParams.get('id')
|
||||||
|
|
||||||
|
if (!id || !["1", "2"].includes(id)) {
|
||||||
|
return new Response("Must be supplied with an id 1 or 2", { status: 400 })
|
||||||
|
}
|
||||||
|
|
||||||
|
const response = await fetch(`https://sdlive-${id}-internal.d-ho.me/playlist.m3u8`)
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
return new Response('Failed to fetch playlist', { status: 500 })
|
||||||
|
}
|
||||||
|
|
||||||
|
const playlist = await response.text()
|
||||||
|
const parsedPlaylist = addSdliveIdsToPlaylist(playlist)
|
||||||
|
|
||||||
|
|
||||||
|
return new Response(parsedPlaylist, {
|
||||||
|
headers: {
|
||||||
|
'Content-Disposition': 'attachment; filename="sdlive-playlist.m3u8"',
|
||||||
|
'Content-Type': 'application/vnd.apple.mpegurl',
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const playlist = await response.text()
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return new Response(playlist, {
|
|
||||||
headers: {
|
|
||||||
'Content-Disposition': 'attachment; filename="sdlive-playlist.m3u8"',
|
|
||||||
'Content-Type': 'application/vnd.apple.mpegurl',
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
export const debugLog = (...data: any[]): void => {
|
||||||
|
if (process.env.LOG_LEVEL === "DEBUG") {
|
||||||
|
console.log(...data)
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user