Spaces:
Sleeping
Sleeping
Download Frontend/src/api.ts from orakzai-io/Async_Web_scraper: direct link, hf CLI and curl.
- Browser
- Download file 709 Bytes
-
https://huggingface.co/spaces/orakzai-io/Async_Web_scraper/resolve/main/Frontend/src/api.ts
- Command line
-
hf download hf://spaces/orakzai-io/Async_Web_scraper/Frontend/src/api.ts
-
curl -L -o api.ts https://huggingface.co/spaces/orakzai-io/Async_Web_scraper/resolve/main/Frontend/src/api.ts
709 Bytes
| const envUrl = import.meta.env.VITE_API_URL; | |
| export const API_URL = (envUrl !== undefined && envUrl !== null) ? envUrl : ''; | |
| export async function submitUrls(urls: string[]) { | |
| const response = await fetch(`${API_URL}/scrape`, { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify({ urls }) | |
| }); | |
| if (!response.ok) { | |
| throw new Error(`Submission failed: ${response.statusText}`); | |
| } | |
| } | |
| export async function getJobs() { | |
| const res = await fetch(`${API_URL}/results`); | |
| if (!res.ok) { | |
| throw new Error(`Failed to fetch jobs`); | |
| } | |
| return res.json(); | |
| } | |
| export function getDownloadUrl() { | |
| return `${API_URL}/download`; | |
| } | |