initial netflix service
This commit is contained in:
parent
d97233056f
commit
f9be77b0aa
0
src/api/routes/netflix/netflix.controller.ts
Normal file
0
src/api/routes/netflix/netflix.controller.ts
Normal file
0
src/api/routes/netflix/netflix.route.ts
Normal file
0
src/api/routes/netflix/netflix.route.ts
Normal file
24
src/api/routes/netflix/netflix.service.ts
Normal file
24
src/api/routes/netflix/netflix.service.ts
Normal file
@ -0,0 +1,24 @@
|
||||
export async function getNetflixBuildID() {
|
||||
try {
|
||||
const response = await fetch(`https://www.netflix.com/buildIdentifier`, {
|
||||
method: 'GET',
|
||||
})
|
||||
|
||||
if (response.ok) {
|
||||
|
||||
const raw = await response.text();
|
||||
|
||||
const parsed: {
|
||||
BUILD_IDENTIFIER: string,
|
||||
isProdVersion: boolean
|
||||
} = await JSON.parse(raw);
|
||||
|
||||
return parsed
|
||||
} else {
|
||||
throw new Error(await response.text())
|
||||
}
|
||||
} catch (e) {
|
||||
console.log('Getting Netflix Build ID failed')
|
||||
throw new Error(e as string)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user