API Documentation
Powerful APIs for web developers to fetch YouTube thumbnails, check broken links, and extract source code from any website.
Easily fetch thumbnails in various resolutions from any YouTube video URL. Perfect for creating video galleries or previews.
Identify broken links on any website to improve SEO and user experience. Get detailed error reports for each broken URL.
Fetch and analyze the source code of any webpage. Great for developers, researchers, and SEO specialists.
Unlike traditional API systems that use tokens, CodiGen Hub employs strict methods to prevent unauthorized API usage:
Extracts the highest quality thumbnail from a YouTube video URL.
Method: GET
Parameters:
url
- The YouTube video URL (required)Success Response:
{ "success": true, "videoId": "dQw4w9WgXcQ", "bestThumbnail": "https://i.ytimg.com/vi/dQw4w9WgXcQ/maxresdefault.jpg" }
Error Response:
{ "success": false, "error": "Invalid YouTube URL" }
Downloads a YouTube thumbnail image directly.
Method: GET
Parameters:
url
- The thumbnail URL (required)Success Response:
Returns the image file with appropriate content-type headers.
// API URL const API_BASE_URL = 'https://thumbnail.codigenhub.site'; // Fetch thumbnail async function fetchThumbnail(youtubeUrl) { try { const response = await fetch(`${API_BASE_URL}/api/thumbnail?url=${encodeURIComponent(youtubeUrl)}`); const data = await response.json(); if (response.ok) { console.log('Thumbnail URL:', data.bestThumbnail); console.log('Video ID:', data.videoId); return data; } else { console.error('Error:', data.error); return null; } } catch (error) { console.error('Network error:', error); return null; } } // Download thumbnail async function downloadThumbnail(thumbnailUrl, videoId) { try { const response = await fetch(`${API_BASE_URL}/api/download?url=${encodeURIComponent(thumbnailUrl)}`); if (!response.ok) throw new Error('Download failed'); const blob = await response.blob(); // Create blob URL and trigger download const blobUrl = window.URL.createObjectURL(blob); const tempLink = document.createElement('a'); tempLink.href = blobUrl; tempLink.download = `youtube-thumbnail-${videoId}.jpg`; document.body.appendChild(tempLink); tempLink.click(); document.body.removeChild(tempLink); // Clean up blob URL window.URL.revokeObjectURL(blobUrl); } catch (error) { console.error('Download error:', error); } }
Scans a website for broken links and returns a detailed report.
Method: POST
Headers:
Content-Type: application/json
Body:
{ "url": "https://example.com" }
Success Response:
{ "brokenLinks": [ { "url": "https://example.com/broken-page", "error": "404 Not Found" }, { "url": "https://example.com/another-broken-link", "error": "500 Internal Server Error" } ], "scannedUrls": 42 }
Error Response:
{ "error": "Invalid URL or unable to access the website" }
async function checkLinks(url) { try { const response = await fetch("https://broken-links.codigenhub.site/api/check-links", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ url }), mode: "cors", cache: "no-store", credentials: "omit", }); if (!response.ok) { throw new Error(`HTTP Error: ${response.status}`); } const data = await response.json(); if (data.error) { console.error('Error:', data.error); return null; } console.log('Broken links found:', data.brokenLinks.length); console.log('URLs scanned:', data.scannedUrls); // Display broken links if (data.brokenLinks.length === 0) { console.log('No broken links found!'); } else { console.log('Broken links:'); data.brokenLinks.forEach(link => { console.log(`- ${link.url} (Error: ${link.error})`); }); } return data; } catch (error) { console.error('Network Error:', error.message); return null; } }
Fetches and returns the source code of any webpage. The API can return both raw and cleaned HTML.
Method: POST
Headers:
Content-Type: application/json
Body:
{ "url": "https://example.com" }
Success Response:
{ "success": true, "data": "<!DOCTYPE html><html>...</html>" }
Error Response:
{ "success": false, "error": "Failed to fetch URL: Network error" }
async function fetchSourceCode(url) { try { // Show loading state console.log('Fetching source code...'); const response = await fetch("https://fetch-source.codigenhub.site/api/fetch-source", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ url }) }); if (!response.ok) { const errorData = await response.json(); throw new Error(errorData.error || `Server error: ${response.status}`); } const data = await response.json(); if (data.success && data.data) { console.log('Source code fetched successfully!'); return data.data; } else { throw new Error(data.error || 'Invalid response format'); } } catch (error) { console.error('Error fetching source code:', error.message); return null; } } // Usage example fetchSourceCode('https://example.com') .then(sourceCode => { if (sourceCode) { // Display or process the source code document.getElementById('sourceCode').value = sourceCode; } });
To get started, visit our purchase page and select the API you want to use. You can start with a 3-day trial for just $1 (refunded after the trial ends).
No, we don't use a traditional token system. Instead, we use other strict methods to prevent unauthorized API usage. Once you purchase access, you can use the API endpoints directly.
Yes, our APIs have fair usage policies to ensure optimal performance for all users. Specific rate limits are provided after purchase and vary by API and subscription level.
Yes, once you purchase access to our APIs, you can use them in both personal and commercial projects. For high-volume commercial use, please contact us for custom pricing.