(videoId: string)
| 177 | } |
| 178 | |
| 179 | async function fetchVideoName(videoId: string): Promise<string | null> { |
| 180 | try { |
| 181 | const response = await fetch("https://www.loom.com/graphql", { |
| 182 | method: "POST", |
| 183 | headers: { |
| 184 | "Content-Type": "application/json", |
| 185 | Accept: "application/json", |
| 186 | "x-loom-request-source": "loom_web", |
| 187 | }, |
| 188 | body: JSON.stringify({ |
| 189 | operationName: "GetVideoName", |
| 190 | variables: { videoId, password: null }, |
| 191 | query: `query GetVideoName($videoId: ID!, $password: String) { |
| 192 | getVideo(id: $videoId, password: $password) { |
| 193 | ... on RegularUserVideo { name } |
| 194 | ... on PrivateVideo { id } |
| 195 | ... on VideoPasswordMissingOrIncorrect { id } |
| 196 | } |
| 197 | }`, |
| 198 | }), |
| 199 | }); |
| 200 | |
| 201 | if (!response.ok) return null; |
| 202 | |
| 203 | const data = await response.json(); |
| 204 | return data?.data?.getVideo?.name ?? null; |
| 205 | } catch { |
| 206 | return null; |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | function isStreamingUrl(url: string): boolean { |
| 211 | const path = (url.split("?")[0] ?? "").toLowerCase(); |
no test coverage detected