Public HTTP API
یک Endpoint واحد برای همه پلتفرمها. لینک مستقیم فایل یا آدرس صفحات ویدیو را بفرستید و لینک دانلود نهایی تحویل بگیرید.
Endpoint
POST /api/public/download
Headers
X-API-Key: کلید احراز هویت اختصاصی شماContent-Type: application/json
Body Payload
{
"url": "https://...", // الزامی
"format": "video" | "audio", // پیشفرض "video"
"quality": "auto" | "144" | "240" | "360" | "480"
| "720" | "1080" | "1440" | "2160" | "max", // فقط ویدیو
"audioFormat": "mp3" | "opus" | "ogg" | "wav" | "best" // فقط صدا
}cURL Example
curl -X POST https://id-preview--e4cffd2e-2549-4ea5-bd31-3c87b3087cca.lovable.app/api/public/download \
-H "Content-Type: application/json" \
-H "X-API-Key: <your key>" \
-d '{"url":"https://www.youtube.com/watch?v=dQw4w9WgXcQ","format":"video","quality":"1080"}'Responses
200 { "status": "success", "type": "redirect"|"tunnel", "url": "...", "filename": "..." }
200 { "status": "success", "type": "picker", "items": [{ "type":"photo|video|gif", "url":"...", "thumb":"..." }] }
400 { "status": "error", "error": "..." }
401 { "error": "invalid api key" }اتصال ربات تلگرام (Node.js)
با ارسال پیام توسط کاربر در ربات، لینک را به این Endpoint بفرستید:
const API = "http://127.0.0.1:8080/api/public/download";
const KEY = process.env.DOWNLOADER_API_KEY;
async function resolve(url, format = "video", quality = "720") {
const r = await fetch(API, {
method: "POST",
headers: { "Content-Type": "application/json", "X-API-Key": KEY },
body: JSON.stringify({ url, format, quality }),
});
return r.json();
}