Download src/tests/youtubePlayer.ts from cursorpro/streamion: direct link, hf CLI and curl.
- Browser
- Download file 974 Bytes
-
https://huggingface.co/spaces/cursorpro/streamion/resolve/main/src/tests/youtubePlayer.ts
- Command line
-
hf download hf://spaces/cursorpro/streamion/src/tests/youtubePlayer.ts
-
curl -L -o youtubePlayer.ts https://huggingface.co/spaces/cursorpro/streamion/resolve/main/src/tests/youtubePlayer.ts
974 Bytes
| import { assert, assertEquals } from "./deps.ts"; | |
| export async function youtubePlayer( | |
| baseUrl: string, | |
| headers: { Authorization: string }, | |
| ) { | |
| const resp = await fetch(`${baseUrl}/youtubei/v1/player`, { | |
| method: "POST", | |
| headers, | |
| body: JSON.stringify({ | |
| videoId: "jNQXAC9IVRw", | |
| }), | |
| }); | |
| assertEquals(resp.status, 200, "response status code is not 200"); | |
| const youtubeV1Player = await resp.json(); | |
| assertEquals( | |
| youtubeV1Player.playabilityStatus?.status, | |
| "OK", | |
| "playabilityStatus is not OK", | |
| ); | |
| assertEquals( | |
| youtubeV1Player.videoDetails?.videoId, | |
| "jNQXAC9IVRw", | |
| "videoDetails is not jNQXAC9IVRw", | |
| ); | |
| assert( | |
| youtubeV1Player.streamingData?.adaptiveFormats, | |
| "adaptiveFormats is not present", | |
| ); | |
| assert( | |
| youtubeV1Player.streamingData?.adaptiveFormats.length > 0, | |
| "adaptiveFormats is empty", | |
| ); | |
| } | |