export type GetApiScrapecreatorsV2TiktokVideoArgs = {url: string, get_transcript?: boolean | undefined, region?: string | undefined, trim?: boolean | undefined}; export type GetApiScrapecreatorsV2TiktokVideoOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Video Info * * GET /scrapecreators/v2/tiktok/video */ export const getApiScrapecreatorsV2TiktokVideo = async (args: GetApiScrapecreatorsV2TiktokVideoArgs, options?: GetApiScrapecreatorsV2TiktokVideoOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.url != null) query.append("url", String(args.url)) if (args.get_transcript != null) query.append("get_transcript", String(args.get_transcript)) if (args.region != null) query.append("region", String(args.region)) if (args.trim != null) query.append("trim", String(args.trim)) const url = `${baseUrl.replace(/\/+$/, '')}/scrapecreators/v2/tiktok/video${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };