### Install Supadata Python SDK Source: https://docs.supadata.ai/sdks/python Installs the Supadata Python SDK using pip. Ensure you have Python and pip installed. ```bash pip install supadata ``` -------------------------------- ### Install Supadata Node SDK Source: https://docs.supadata.ai/sdks/node Installs the Supadata Node SDK using npm. This is the first step to integrate Supadata's functionality into your Node.js project. ```bash npm install @supadata/js ``` -------------------------------- ### Initialize Supadata Client and Get Transcript Source: https://docs.supadata.ai/sdks/node Initializes the Supadata client with an API key and demonstrates how to get a transcript from a given URL. It handles both direct transcript retrieval and asynchronous job processing. ```javascript import { Crawl, CrawlJob, JobResult, Map, Scrape, Supadata, Transcript, TranscriptOrJobId, YoutubeChannel, YoutubePlaylist, YoutubeVideo, } from "@supadata/js"; // Initialize the client const supadata = new Supadata({ apiKey: "YOUR_API_KEY", }); // Get transcript from any supported platform (YouTube, TikTok, Instagram, X (Twitter)) or file const transcriptResult = await supadata.transcript({ url: "https://www.youtube.com/watch?v=dQw4w9WgXcQ", lang: "en", // optional text: true, // optional: return plain text instead of timestamped chunks mode: "auto", // optional: 'native', 'auto', or 'generate' }); // Check if we got a transcript directly or a job ID for async processing if ("jobId" in transcriptResult) { // For large files, we get a job ID and need to poll for results console.log(`Started transcript job: ${transcriptResult.jobId}`); // Poll for job status const jobResult = await supadata.transcript.getJobStatus( transcriptResult.jobId ); if (jobResult.status === "completed") { console.log("Transcript:", jobResult.content); } else if (jobResult.status === "failed") { console.error("Transcript failed:", jobResult.error); } else { console.log("Job status:", jobResult.status); // 'queued' or 'active' } } else { // For smaller files, we get the transcript directly console.log("Transcript:", transcriptResult); } ``` -------------------------------- ### Start and Get Supadata Web Crawl Results Source: https://docs.supadata.ai/sdks/python Initiates a web crawl job using the Supadata SDK, specifying a URL and an optional page limit. It then retrieves and processes the crawl results, printing the URL, title, and content of each crawled page. Includes error handling for failed crawl jobs. ```python crawl_job = supadata.web.crawl( url="https://supadata.ai", limit=100 # Optional: limit the number of pages to crawl ) print(f"Started crawl job: {crawl_job.job_id}") try: pages = supadata.web.get_crawl_results(job_id=crawl_job.job_id) for page in pages: print(f"Crawled page: {page.url}") print(f"Page title: {page.name}") print(f"Content: {page.content}") except SupadataError as e: print(f"Crawl job failed: {e}") ``` -------------------------------- ### Supadata API Authentication Header Source: https://docs.supadata.ai/api-reference/introduction Example of how to include the API key in the request header for authentication. Replace '{YOUR_API_KEY}' with your actual Supadata API key. ```sh x-api-key: {YOUR_API_KEY} ``` -------------------------------- ### Curl API Call with Header Source: https://supadata.featurebase.app/ Shows a basic example of how to make an API call using `curl` with a custom header for authentication, which is a common pattern for interacting with RESTful APIs. ```bash curl -H "x-api-key: [MY API KEY]" https://api ... ``` -------------------------------- ### Example Transcript Chunk (JSON) Source: https://docs.supadata.ai/api-reference/endpoint/transcript/transcript An example of a 'TranscriptChunk' object, demonstrating a piece of transcribed text with its associated offset, duration, and language. ```json { "text": "Never gonna give you up...", "offset": 8150, "duration": 1200, "lang": "en" } ``` -------------------------------- ### Web Map API Source: https://context7_llms Scan a whole website and get a list of all URLs on it. ```APIDOC ## GET /api/web/map ### Description Scan a whole website and get URLs on it. Can be used to create a sitemap or run a crawler to fetch content of all pages of a destination. ### Method GET ### Endpoint /api/web/map ### Parameters #### Query Parameters - **url** (string) - Required - The starting URL of the website to map. ### Response #### Success Response (200) - **urls** (array) - An array of strings, where each string is a URL found on the website. #### Response Example { "urls": [ "https://example.com/page1", "https://example.com/page2", "https://example.com/about" ] } ``` -------------------------------- ### GET /v1/youtube/playlist Source: https://docs.supadata.ai/youtube/playlist Fetches metadata for a given YouTube playlist, including its title, description, video count, and channel information. ```APIDOC ## GET /v1/youtube/playlist ### Description Fetches metadata for a given YouTube playlist, including its title, description, video count, and channel information. ### Method GET ### Endpoint https://api.supadata.ai/v1/youtube/playlist ### Parameters #### Query Parameters - **id** (string) - Required - YouTube playlist URL or ID. See [Supported YouTube URL Formats](/youtube/supported-url-formats). #### Headers - **x-api-key** (string) - Required - Your API key available after signing up. ### Request Example ```bash curl -X GET 'https://api.supadata.ai/v1/youtube/playlist?id=PLlaN88a7y2_plecYoJxvRFTLHVbIVAOoc' \ -H 'x-api-key: YOUR_API_KEY' ``` ### Response #### Success Response (200) - **id** (string) - The unique identifier of the playlist. - **title** (string) - The title of the playlist. - **description** (string) - The description of the playlist. - **videoCount** (integer) - The number of videos in the playlist. - **viewCount** (integer) - The total view count of the playlist. - **lastUpdated** (string) - The date and time when the playlist was last updated. - **channel** (object) - Information about the channel that owns the playlist. - **id** (string) - The unique identifier of the channel. - **name** (string) - The name of the channel. #### Response Example ```json { "id": "PLlaN88a7y2_plecYoJxvRFTLHVbIVAOoc", "title": "My Favorite Videos", "description": "A collection of my favorite videos", "videoCount": 25, "viewCount": 1000000, "lastUpdated": "2023-01-01T00:00:00.000Z", "channel": { "id": "UCuAXFkgsw1L7xaCfnd5JJOw", "name": "Rick Astley" } } ``` ``` -------------------------------- ### YouTube Batch Operations Source: https://supadata.ai/playground Get multiple transcripts or video metadata from YouTube videos in a playlist, channel or list of URLs. ```APIDOC ## POST /documentation-legacy/youtube/batch ### Description Performs batch operations on YouTube videos. ### Method POST ### Endpoint /documentation-legacy/youtube/batch ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **operations** (array) - A list of operations to perform. - **type** (string) - The type of operation (e.g., 'get_transcript', 'get_video_metadata'). - **url** (string) - The URL of the YouTube video. ### Request Example { "example": "{\"operations\": [{\"type\": \"get_transcript\", \"url\": \"https://www.youtube.com/watch?v=VIDEOID1\"}, {\"type\": \"get_video_metadata\", \"url\": \"https://www.youtube.com/watch?v=VIDEOID2\"}]}" } ### Response #### Success Response (200) - **results** (array) - The results of the batch operations. #### Response Example { "example": "{\"results\": [{\"status\": \"success\", \"data\": {\"transcript\": \"Transcript for video 1...\"}}, {\"status\": \"success\", \"data\": {\"title\": \"Video 2 Title\"}}]}" } ``` -------------------------------- ### Submit YouTube Batch Jobs and Get Results Source: https://docs.supadata.ai/sdks/node Submits batch jobs for YouTube transcripts and video metadata, and demonstrates how to retrieve the results of these batch jobs by polling their status. ```javascript // Start a YouTube transcript batch job const transcriptBatch = await supadata.youtube.transcript.batch({ videoIds: ['dQw4w9WgXcQ', 'xvFZjo5PgG0'], // playlistId: 'PLlaN88a7y2_plecYoJxvRFTLHVbIVAOoc' // alternatively // channelId: 'UC_9-kyTW8ZkZNDHQJ6FgpwQ' // alternatively lang: 'en', }); console.log(`Started transcript batch job: ${transcriptBatch.jobId}`); // Start a YouTube video metadata batch job const videoBatch = await supadata.youtube.video.batch({ videoIds: ['dQw4w9WgXcQ', 'xvFZjo5PgG0', 'L_jWHffIx5E'], // playlistId: 'PLlaN88a7y2_plecYoJxvRFTLHVbIVAOoc' // alternatively // channelId: 'UC_9-kyTW8ZkZNDHQJ6FgpwQ' // alternatively }); console.log(`Started video batch job: ${videoBatch.jobId}`); // Get results for a batch job (poll until status is 'completed' or 'failed') const batchResults = await supadata.youtube.batch.getBatchResults( transcriptBatch.jobId ); // or videoBatch.jobId if (batchResults.status === 'completed') { console.log('Batch job completed:', batchResults.results); console.log('Stats:', batchResults.stats); } else { console.log('Batch job status:', batchResults.status); } ``` -------------------------------- ### GET /api/web/crawl/{jobId} - Retrieve Crawl Job Results Source: https://docs.supadata.ai/web/crawl Retrieves the results of a previously started crawl job. It provides the status of the job and the crawled content. Handles pagination for large crawls. ```APIDOC ## GET /api/web/crawl/{jobId} ### Description Retrieves the results of a previously started crawl job. It provides the status of the job and the crawled content. Handles pagination for large crawls. ### Method GET ### Endpoint /api/web/crawl/{jobId} ### Parameters #### Path Parameters - **jobId** (string) - Required - The ID of the crawl job to retrieve results for. #### Query Parameters N/A #### Request Body N/A ### Response #### Success Response (200) - **status** (string) - The status of the crawl job: 'scraping', 'completed', 'failed' or 'cancelled' - **pages** (array) - If job is completed, contains list of pages that were crawled. Each page object includes 'url', 'content', 'name', and 'description'. - **next** (string) - If large crawls are paginated, this contains a token to get the next page of results. #### Response Example ```json { "status": "completed", "pages": [ { "url": "https://supadata.ai/page1", "content": "Markdown content of page 1.", "name": "Page 1 Title", "description": "Description of page 1." } ], "next": null } ``` ``` -------------------------------- ### Get YouTube Batch Job Results (Node.js, Python, cURL) Source: https://docs.supadata.ai/api-reference/endpoint/youtube/batch-get This snippet shows how to retrieve the results of a YouTube batch processing job using the Supadata API. It provides examples for Node.js (TypeScript), Python, and cURL, demonstrating how to make the GET request and handle the response. Ensure you replace 'YOUR_API_KEY' and 'JOB_ID' with your actual credentials and job identifier. ```TypeScript import { Supadata } from '@supadata/js'; const supadata = new Supadata({ apiKey: 'YOUR_API_KEY', }); const batchResults = await supadata.youtube.batch.getBatchResults(JOB_ID); console.log(batchResults); ``` ```Python from supadata import Supadata, SupadataError supadata = Supadata(api_key="YOUR_API_KEY") batch_results = supadata.youtube.batch.get_batch_results(job_id=JOB_ID) print(batch_results) ``` ```Shell curl -X GET "https://api.supadata.ai/v1/youtube/batch/JOB_ID" \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" ``` -------------------------------- ### SDKs Source: https://context7_llms Information on available SDKs for interacting with the Supadata API. ```APIDOC ## Supadata Node.js SDK ### Description Supadata Node SDK is a wrapper around the Supadata API to help you easily turn videos into transcripts and websites into markdown. ### Documentation [https://docs.supadata.ai/sdks/node.md](https://docs.supadata.ai/sdks/node.md) ## Supadata Python SDK ### Description Supadata Python SDK is a wrapper around the Supadata API to help you easily turn videos into transcripts and websites into markdown. ### Documentation [https://docs.supadata.ai/sdks/python.md](https://docs.supadata.ai/sdks/python.md) ## SDK Overview ### Description Supadata SDKs are wrappers around the Supadata API to help you easily extract data from websites. ### Documentation [https://docs.supadata.ai/sdks/overview.md](https://docs.supadata.ai/sdks/overview.md) ``` -------------------------------- ### HTML Structure and Configuration for Next.js App Source: https://supadata.ai/playground This snippet shows the basic HTML structure of a Next.js application, including the `` and `` tags with specific class names for styling. It also includes configuration details for theme switching and page routing. ```html self.__next_f.push([1,"2:[\"$\",\"html\",null,{\"lang\":\"en\",\"suppressHydrationWarning\":true,\"children\":[[\"$\",\"head\",null,{}],[\"$\",\"body\",null,{\"className\":\"\\\n__variable_0bdc47 bg-background font-mono antialiased\",\"children\":[\"$\",\"$L11\",null,{\"children\":[[\"$\",\"$L12\",null,{\"value\":{\"darkMode\":true,\"docsRepositoryBase\":\"https://github.com/shuding/nextra\",\"editLink\":null,\"feedback\":{\"content\":null,\"labels\":\"feedback\"},\"i18n\":[],\"lastUpdated\":[\"$\",\"div\",null,{}],\"navigation\":{\"next\":true,\"prev\":true},\"search\":[\"$\",\"$L13\",null,{}],\"sidebar\":{\"autoCollapse\":true,\"defaultMenuCollapseLevel\":1,\"toggleButton\":true},\"themeSwitch\":{\"dark\":\"Dark\",\"light\":\"Light\",\"system\":\"System\"},\"toc\":{\"backToTop\":\"Scroll to top\",\"float\":true,\"title\":\"On This Page\"}},\"children\":[\"$\",\"$L14\",null,{\"attribute\":\"class\",\"defaultTheme\":\"light\",\"disableTransitionOnChange\":true,\"children\":[[\"$\",\"$L15\",null,{}],\"$undefined\",[\"$\",\"$L16\",null,{\"pageMap\":[{\"data\":{\"index\":{\"type\":\"page\",\"display\":\"hidden\",\"theme\":{\"typesetting\":\"article\"}},\"playground\":{\"type\":\"page\",\"title\":\"P ``` -------------------------------- ### Fetch YouTube Transcript (Node.js) Source: https://docs.supadata.ai/youtube/get-transcript Initializes the Supadata client and fetches a YouTube video transcript using the client library. Requires an API key and a YouTube URL. ```javascript import { Supadata, Transcript } from "@supadata/js"; // Initialize the client const supadata = new Supadata({ apiKey: "YOUR_API_KEY", }); const transcript: Transcript = await supadata.youtube.transcript({ url: "https://youtu.be/dQw4w9WgXcQ", }); console.log(transcript); ``` -------------------------------- ### Scrape and Crawl Web Content with Supadata SDK Source: https://docs.supadata.ai/sdks/node Scrapes web content, maps website URLs, and initiates website crawls. It also shows how to retrieve the results of a crawl job. This functionality requires the Supadata SDK to be installed and configured. ```javascript const webContent = await supadata.web.scrape('https://supadata.ai'); // Map website URLs const siteMap = await supadata.web.map('https://supadata.ai'); // Crawl website const crawl = await supadata.web.crawl({ url: 'https://supadata.ai', limit: 10, }); // Get crawl job results const crawlResults = await supadata.web.getCrawlResults(crawl.jobId); ``` -------------------------------- ### Example Invalid Request Error (JSON) Source: https://docs.supadata.ai/api-reference/endpoint/youtube/translation An example of a JSON payload representing an 'Invalid Request' error (HTTP 400). It includes the standard error properties: 'error', 'message', 'details', and 'documentationUrl'. ```json { "error": "invalid-request", "message": "Invalid Request", "details": "The request is invalid or malformed", "documentationUrl": "https://supadata.ai/documentation/errors#invalid-request" } ``` -------------------------------- ### Supadata Web Map API Code Samples (Node.js, Python, cURL) Source: https://docs.supadata.ai/api-reference/endpoint/web/map Code samples for interacting with the Supadata Web Map API. These examples demonstrate how to retrieve a sitemap from a given URL using Node.js, Python, and cURL. They require an API key for authentication. ```TypeScript import { Supadata } from '@supadata/js'; const supadata = new Supadata({ apiKey: 'YOUR_API_KEY', }); const siteMap = await supadata.web.map('https://example.com'); console.log(siteMap); ``` ```Python from supadata import Supadata supadata = Supadata(api_key="YOUR_API_KEY") site_map = supadata.web.map("https://example.com") print(f"Found {len(site_map.urls)} URLs") ``` ```Shell curl -X GET "https://api.supadata.ai/v1/web/map?url=https://example.com" \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" ``` -------------------------------- ### Web Crawling Source: https://docs.supadata.ai/sdks/node Initiate a web crawl job for a specified website with optional limits. ```APIDOC ## POST /web/crawl ### Description Initiates a web crawling job for a given URL. ### Method POST ### Endpoint /web/crawl ### Parameters #### Request Body - **url** (string) - Required - The starting URL for the crawl. - **limit** (integer) - Optional - The maximum number of pages to crawl. ### Request Example ```json { "url": "https://supadata.ai", "limit": 10 } ``` ### Response #### Success Response (200) - **jobId** (string) - The ID of the initiated crawl job. #### Response Example ```json { "jobId": "crawl-12345" } ``` ``` -------------------------------- ### cURL: Get Job Status Source: https://docs.supadata.ai/api-reference/endpoint/transcript/transcript This cURL command shows how to check the status of an asynchronous transcript generation job using the Supadata API. It requires the job ID obtained from a previous transcript request and the API key for authentication. The command makes a GET request to the specific job status endpoint. ```Shell curl -X GET "https://api.supadata.ai/v1/transcript/JOB_ID" \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" ``` -------------------------------- ### Supported URL Formats Source: https://supadata.ai/playground Lists the supported URL formats for YouTube content. ```APIDOC ## GET /documentation-legacy/youtube/supported-url-formats ### Description Lists the supported URL formats for YouTube content. ### Method GET ### Endpoint /documentation-legacy/youtube/supported-url-formats ### Parameters None ### Request Example None ### Response #### Success Response (200) - **supported_formats** (array) - A list of supported URL formats. #### Response Example { "example": "{\"supported_formats\": [\"youtube.com/watch?v=VIDEO_ID\", \"youtu.be/VIDEO_ID\"]}" } ``` -------------------------------- ### cURL: Initiate and Retrieve Web Crawl Jobs Source: https://docs.supadata.ai/api-reference/endpoint/web/crawl-get This section provides cURL commands for interacting with the Supadata web crawl API. It includes a command to start a new crawl job by specifying a URL and an optional limit, and another command to retrieve the results of a previously started job using its ID. ```Shell curl -X POST "https://api.supadata.ai/v1/web/crawl" \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.com", "limit": 10 }' ``` ```Shell curl -X GET "https://api.supadata.ai/v1/web/crawl/JOB_ID" \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" ``` -------------------------------- ### cURL: Get Transcript Source: https://docs.supadata.ai/api-reference/endpoint/transcript/transcript This cURL command demonstrates how to make a GET request to the Supadata API's transcript endpoint to fetch a video transcript. It includes the necessary API key in the headers and query parameters for the video URL, desired language, text format, and transcription mode. This is useful for testing the API directly or for use in shell scripts. ```Shell curl -X GET "https://api.supadata.ai/v1/transcript?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdQw4w9WgXcQ&lang=en&text=true&mode=auto" \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" ``` -------------------------------- ### Fetch YouTube Channel Videos (Node.js, Python, cURL) Source: https://docs.supadata.ai/api-reference/endpoint/youtube/channel-videos Provides code examples for fetching YouTube channel videos using the Supadata API. It demonstrates how to specify channel ID, limit results, and filter by video type. Dependencies include the Supadata client library for Node.js and Python, or cURL for direct HTTP requests. ```TypeScript import { Supadata } from '@supadata/js'; const supadata = new Supadata({ apiKey: 'YOUR_API_KEY', }); const videos = await supadata.youtube.channel.videos({ id: 'RickAstleyVEVO', // can be url, id, handle limit: 50, // Optional: limit the number of videos to fetch type: 'all', // Optional: 'all', 'video', 'short', 'live' (default 'all') }); console.log(`Found ${videos.videoIds.length} regular videos, ${videos.shortIds.length} shorts, and ${videos.liveIds.length} live streams.`); ``` ```Python from supadata import Supadata supadata = Supadata(api_key="YOUR_API_KEY") videos = supadata.youtube.channel.videos( id="RickAstleyVEVO", # can be url, id, handle limit=50, # Optional: limit the number of videos to fetch type="all" # Optional: 'all', 'video', 'short', 'live' (default 'all') ) print(f"Found {len(videos.video_ids)} regular videos, {len(videos.short_ids)} shorts, and {len(videos.live_ids)} live streams.") ``` ```Shell curl -X GET "https://api.supadata.ai/v1/youtube/channel/videos?id=RickAstleyVEVO&limit=50&type=all" \ -H "x-api-key: YOUR_API_KEY" \ -H "Content-Type: application/json" ``` -------------------------------- ### Check YouTube Batch Job Status (Node.js, Python, cURL) Source: https://docs.supadata.ai/youtube/batch This snippet demonstrates how to check the status and retrieve results of a YouTube batch job using the Supadata API. It includes examples in Node.js and Python for handling the response, checking completion, and processing individual video results or errors. A cURL example is also provided for direct API interaction. ```javascript import { Supadata } from "@supadata/js"; const supadata = new Supadata("YOUR_API_KEY"); // Check the status of a batch job const batchResult = await supadata.youtube.batch.getJobStatus(jobId); if (batchResult.status === "completed") { console.log("Batch job completed successfully!"); console.log(`Total videos: ${batchResult.stats.total}`); console.log(`Succeeded: ${batchResult.stats.succeeded}`); console.log(`Failed: ${batchResult.stats.failed}`); // Process each result batchResult.results.forEach((result, index) => { if (result.transcript) { console.log(`Video ${index + 1}: ${result.videoId}`); console.log(`Transcript: ${result.transcript.content}`); console.log(`Language: ${result.transcript.lang}`); } else if (result.errorCode) { console.log(`Video ${index + 1} failed: ${result.errorCode}`); } }); } else if (batchResult.status === "failed") { console.error("Batch job failed:", batchResult.error); } else { console.log("Job status:", batchResult.status); } ``` ```python from supadata import Supadata supadata = Supadata("YOUR_API_KEY") # Check the status of a batch job batch_result = supadata.youtube.batch.get_job_status(job_id) if batch_result.status == "completed": print("Batch job completed successfully!") print(f"Total videos: {batch_result.stats.total}") print(f"Succeeded: {batch_result.stats.succeeded}") print(f"Failed: {batch_result.stats.failed}") # Process each result for i, result in enumerate(batch_result.results): if hasattr(result, 'transcript') and result.transcript: print(f"Video {i + 1}: {result.video_id}") print(f"Transcript: {result.transcript.content}") print(f"Language: {result.transcript.lang}") elif hasattr(result, 'error_code'): print(f"Video {i + 1} failed: {result.error_code}") elif batch_result.status == "failed": print(f"Batch job failed: {batch_result.error}") else: print(f"Job status: {batch_result.status}") ``` ```bash curl -X GET 'https://api.supadata.ai/v1/youtube/batch/123e4567-e89b-12d3-a456-426614174000' \ -H 'x-api-key: YOUR_API_KEY' ``` -------------------------------- ### GET /v1/youtube/video Source: https://docs.supadata.ai/youtube/video Retrieve metadata for a YouTube video by providing its URL or ID. ```APIDOC ## GET /v1/youtube/video ### Description Fetches metadata from a YouTube video including title, description, channel info, duration, tags, and more. ### Method GET ### Endpoint https://api.supadata.ai/v1/youtube/video ### Parameters #### Query Parameters - **id** (string) - Required - YouTube video URL or ID. See [Supported YouTube URL Formats](/youtube/supported-url-formats). #### Request Headers - **x-api-key** (string) - Required - Your API key. ### Request Example ```bash curl -X GET 'https://api.supadata.ai/v1/youtube/video?id=dQw4w9WgXcQ' \ -H 'x-api-key: YOUR_API_KEY' ``` ### Response #### Success Response (200) - **id** (string) - The YouTube video ID. - **title** (string) - The title of the YouTube video. - **description** (string) - The description of the YouTube video. - **duration** (integer) - The duration of the video in seconds. - **channel** (object) - Information about the video's channel. - **id** (string) - The channel ID. - **name** (string) - The channel name. - **tags** (array of strings) - An array of tags associated with the video. - **thumbnail** (string) - URL of the video's thumbnail. - **uploadDate** (string) - The ISO 8601 formatted date and time when the video was uploaded. - **viewCount** (integer) - The total number of views for the video. - **likeCount** (integer) - The total number of likes for the video. - **transcriptLanguages** (array of strings) - An array of languages for which transcripts are available. #### Response Example ```json { "id": "dQw4w9WgXcQ", "title": "Rick Astley - Never Gonna Give You Up (Official Music Video)", "description": "The official music video for \"Never Gonna Give You Up\"...", "duration": 213, "channel": { "id": "UCuAXFkgsw1L7xaCfnd5JJOw", "name": "Rick Astley" }, "tags": ["Rick Astley", "Official Video", "Music"], "thumbnail": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg", "uploadDate": "2009-10-25T00:00:00.000Z", "viewCount": 1234567890, "likeCount": 12345678, "transcriptLanguages": ["en", "es", "fr"] } ``` ### Error Handling See [Error Codes](/errors) for more details on potential error responses. ``` -------------------------------- ### GET /transcript/:jobId Source: https://docs.supadata.ai/api-reference/endpoint/transcript/transcript Retrieves the transcript for a previously submitted job. ```APIDOC ## GET /transcript/:jobId ### Description Retrieves the transcript results for a job previously initiated via the `/transcript` endpoint when the video was too large for immediate processing. ### Method GET ### Endpoint /transcript/:jobId ### Parameters #### Path Parameters - **jobId** (string) - Required - The job ID returned from the initial `/transcript` request. ### Request Example ``` GET /transcript/a1b2c3d4-e5f6-7890-1234-567890abcdef ``` ### Response #### Success Response (200) - **transcript** (string) - The extracted transcript text. - **status** (string) - The status of the job (e.g., 'completed', 'processing', 'failed'). #### Response Example ```json { "transcript": "This is the transcript of the video...", "status": "completed" } ``` ``` -------------------------------- ### Next.js Dynamic Import: MobileNav Component Source: https://supadata.ai/playground This snippet illustrates the dynamic loading of the 'MobileNav' component, likely for responsive navigation elements. It specifies the associated JavaScript files. ```javascript self.__next_f.push([1,"42\",\"static/chunks/493ff4cd-d42ed3bfb021ede3.js?dpl=dpl_FHy9WmUNycv7z6V6uQMNPQV1zFh7\",\"930\",\"static/chunks/a7a20f37-f537a98fd30a60b0.js?dpl=dpl_FHy9WmUNycv7z6V6uQMNPQV1zFh7\",\"761\",\"static/chunks/761-1ee4a95575c3b36e.js?dpl=dpl_FHy9WmUNycv7z6V6uQMNPQV1zFh7\",\"336\",\"static/chunks/336-47c346a005000364.js?dpl=dpl_FHy9WmUNycv7z6V6uQMNPQV1zFh7\",\"355\",\"static/chunks/355-bd96a0f5c7c37bd2.js?dpl=dpl_FHy9WmUNycv7z6V6uQMNPQV1zFh7\",\"217\",\"static/chunks/app/%5B%5B...mdxPath%5D%5D/page-cb17a64b7efca28a.js?dpl=dpl_FHy9WmUNycv7z6V6uQMNPQV1zFh7\"],"MobileNav"]) ``` -------------------------------- ### Get Crawl Job Results Source: https://docs.supadata.ai/sdks/node Retrieve the results of a previously initiated web crawl job. ```APIDOC ## GET /web/crawl/results/{jobId} ### Description Retrieves the results of a web crawl job using its ID. ### Method GET ### Endpoint /web/crawl/results/{jobId} ### Parameters #### Path Parameters - **jobId** (string) - Required - The ID of the crawl job. ### Response #### Success Response (200) - **results** (array) - An array containing the crawl results, where each item might include URL, content, etc. #### Response Example ```json { "results": [ { "url": "https://supadata.ai", "status": 200 }, { "url": "https://supadata.ai/about", "status": 200 } ] } ``` ``` -------------------------------- ### Search YouTube Videos, Channels, and Playlists (Python) Source: https://docs.supadata.ai/youtube/search Shows how to initialize the Supadata client and conduct a YouTube search using Python, supporting parameters like query, type, limit, and filters. Requires the 'supadata' library and an API key. ```python from supadata import Supadata # Initialize the client supadata = Supadata(api_key="YOUR_API_KEY") search_results = supadata.youtube.search( query="never gonna give you up", type="video", # Optional: 'video', 'channel', 'playlist', 'all' (default 'all') limit=20, # Optional: get more than the first page of results sort_by="views", # Optional: 'relevance', 'rating', 'date', 'views' upload_date="year", # Optional: 'hour', 'today', 'week', 'month', 'year' duration="medium", # Optional: 'short', 'medium', 'long', features=["hd", "subtitles"], # Optional ) print(f"Found {len(search_results.results)} results") for result in search_results.results: print(f"{result.type}: {result.title}") ``` -------------------------------- ### Next.js Dynamic Import: NotFoundLink Component Source: https://supadata.ai/playground This snippet shows the dynamic import for a 'NotFoundLink' component, typically used for handling 404 error pages. It lists the JavaScript dependencies. ```javascript self.__next_f.push([1,"42\",\"static/chunks/493ff4cd-d42ed3bfb021ede3.js?dpl=dpl_FHy9WmUNycv7z6V6uQMNPQV1zFh7\",\"930\",\"static/chunks/a7a20f37-f537a98fd30a60b0.js?dpl=dpl_FHy9WmUNycv7z6V6uQMNPQV1zFh7\",\"761\",\"static/chunks/761-1ee4a95575c3b36e.js?dpl=dpl_FHy9WmUNycv7z6V6uQMNPQV1zFh7\",\"336\",\"static/chunks/336-47c346a005000364.js?dpl=dpl_FHy9WmUNycv7z6V6uQMNPQV1zFh7\",\"355\",\"static/chunks/355-bd96a0f5c7c37bd2.js?dpl=dpl_FHy9WmUNycv7z6V6uQMNPQV1zFh7\",\"217\",\"static/chunks/app/%5B%5B...mdxPath%5D%5D/page-cb17a64b7efca28a.js?dpl=dpl_FHy9WmUNycv7z6V6uQMNPQV1zFh7\"],"NotFoundLink"]) ``` -------------------------------- ### GET /llmstxt/supadata_ai_llms_txt Source: https://docs.supadata.ai/api-reference/endpoint/youtube/video-get Retrieves metadata for a specific YouTube video. Requires a valid video ID. ```APIDOC ## GET /llmstxt/supadata_ai_llms_txt ### Description Retrieves metadata for a specific YouTube video, including its title, description, duration, channel details, tags, and available transcript languages. ### Method GET ### Endpoint /llmstxt/supadata_ai_llms_txt ### Parameters #### Query Parameters - **id** (string) - Required - The unique identifier of the YouTube video. ### Request Example ```http GET /llmstxt/supadata_ai_llms_txt?id=dQw4w9WgXcQ ``` ### Response #### Success Response (200) - **id** (string) - The YouTube video ID. - **title** (string) - The title of the video. - **description** (string) - The description of the video. - **duration** (integer) - The duration of the video in seconds. - **channel** (object) - Information about the channel. - **id** (string) - The channel ID. - **name** (string) - The channel name. - **tags** (array of strings) - A list of tags associated with the video. - **thumbnail** (string) - URL to the video's thumbnail image. - **uploadDate** (string) - The date the video was uploaded (ISO 8601 format). - **viewCount** (integer) - The number of times the video has been viewed. - **likeCount** (integer) - The number of likes the video has received. - **transcriptLanguages** (array of strings) - A list of languages for which transcripts are available. #### Response Example ```json { "id": "dQw4w9WgXcQ", "title": "Rick Astley - Never Gonna Give You Up (Official Music Video)", "description": "The official music video for \"Never Gonna Give You Up...", "duration": 213, "channel": { "id": "UCuAXFkgsw1L7xaCfnd5JJOw", "name": "Rick Astley" }, "tags": [ "Rick Astley", "Official Video", "Music" ], "thumbnail": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg", "uploadDate": "2009-10-25T00:00:00.000Z", "viewCount": 1234567890, "likeCount": 12345678, "transcriptLanguages": [ "en", "es", "fr" ] } ``` #### Error Responses - **400 Bad Request**: Returned if the request is invalid or malformed. Includes `error`, `message`, `details`, and `documentationUrl`. - **404 Not Found**: Returned if the video ID is not found. Includes `error`, `message`, `details`, and `documentationUrl`. - **500 Internal Server Error**: Returned if an unexpected error occurs on the server. Includes `error`, `message`, `details`, and `documentationUrl`. ``` -------------------------------- ### Search YouTube Videos, Channels, and Playlists (Node.js) Source: https://docs.supadata.ai/youtube/search Demonstrates how to initialize the Supadata client and perform a YouTube search with various parameters like query, type, limit, and filters. Requires the '@supadata/js' library and an API key. ```javascript import { Supadata } from "@supadata/js"; // Initialize the client const supadata = new Supadata({ apiKey: "YOUR_API_KEY", }); const searchResults = await supadata.youtube.search({ query: "never gonna give you up", type: "video", // Optional: 'video', 'channel', 'playlist', 'all' (default 'all') limit: 20, // Optional: get more than the first page of results sortBy: "views", // Optional: 'relevance', 'rating', 'date', 'views' uploadDate: "year", // Optional: 'hour', 'today', 'week', 'month', 'year' duration: "medium", // Optional: 'short', 'medium', 'long', features: ["hd", "subtitles"], // Optional }); console.log(`Found ${searchResults.results.length} results`); ``` -------------------------------- ### GET /youtube/video Source: https://docs.supadata.ai/api-reference/endpoint/youtube/video-get Retrieves detailed information about a specific YouTube video using its URL or ID. ```APIDOC ## GET /youtube/video ### Description Retrieves detailed information about a specific YouTube video using its URL or ID. ### Method GET ### Endpoint /youtube/video ### Parameters #### Query Parameters - **id** (string) - Required - YouTube video URL or ID. See [supported URL formats](https://supadata.ai/documentation/youtube/supported-url-formats). ### Request Example ```json { "id": "https://youtu.be/dQw4w9WgXcQ" } ``` ### Response #### Success Response (200) - **id** (string) - YouTube video ID - **title** (string) - Video title - **description** (string) - Video description - **duration** (number) - Video duration in seconds - **channel** (object) - Channel information - **id** (string) - Channel ID - **name** (string) - Channel name - **tags** (array of strings) - Video tags - **thumbnail** (string) - URL to video thumbnail - **uploadDate** (string) - Video upload date - **viewCount** (number) - Number of views - **likeCount** (number) - Number of likes - **transcriptLanguages** (array of strings) - Available transcript language codes #### Response Example ```json { "id": "dQw4w9WgXcQ", "title": "Rick Astley - Never Gonna Give You Up (Official Music Video)", "description": "The official music video for \"Never Gonna Give You Up\"...", "duration": 213, "channel": { "id": "UCuAXFkgsw1L7xaCfnd5JJOw", "name": "Rick Astley" }, "tags": [ "Rick Astley", "Official Video", "Music" ], "thumbnail": "https://i.ytimg.com/vi/dQw4w9WgXcQ/hqdefault.jpg", "uploadDate": "2009-10-25T00:00:00.000Z", "viewCount": 1234567890, "likeCount": 12345678, "transcriptLanguages": [ "en", "es" ] } ``` ``` -------------------------------- ### Get Transcript Source: https://docs.supadata.ai/api-reference/endpoint/youtube/transcript Fetches the transcript of a YouTube video. It supports specifying a language, and if the requested language is not available, it defaults to the first available language. ```APIDOC ## GET /transcript ### Description Retrieves the transcript of a YouTube video. ### Method GET ### Endpoint /transcript #### Query Parameters - **url** (string) - Required - The URL of the YouTube video. - **lang** (string) - Optional - The desired language for the transcript (e.g., 'en', 'es'). Defaults to the first available language if not provided or not found. ``` -------------------------------- ### Fetch YouTube Playlist Metadata (Python) Source: https://docs.supadata.ai/youtube/playlist Initializes the Supadata client and fetches metadata for a YouTube playlist using its URL, channel ID, or handle. Requires an API key. ```python from supadata import Supadata, SupadataError # Initialize the client supadata = Supadata(api_key="YOUR_API_KEY") channel = supadata.youtube.channel(id="https://youtube.com/@RickAstleyVEVO") # can be url, channel id, handle print(f"Channel: {channel}") ```