Skip to content

Instantly share code, notes, and snippets.

@xbladev
Created February 17, 2026 18:16
Show Gist options
  • Select an option

  • Save xbladev/255b88cd118f3b8214fac6a813d09ff1 to your computer and use it in GitHub Desktop.

Select an option

Save xbladev/255b88cd118f3b8214fac6a813d09ff1 to your computer and use it in GitHub Desktop.
ytmp3 gg scraper
//Free Scrape Channel
// https://whatsapp.com/channel/0029Vb6xGdD11ulNhYPtMt3j
async function ytdl(youtubeUrl, format = "mp3", quality = "128k") {
try {
const headers = {
"Content-Type": "application/json",
"Origin": "https://ytmp3.gg",
"Referer": "https://ytmp3.gg/",
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
};
const isVideo = format === "mp4";
const payload = {
url: youtubeUrl,
os: "windows",
output: {
type: isVideo ? "video" : "audio",
format: format,
...(isVideo && { quality: quality })
},
...(!isVideo && { audio: { bitrate: quality } })
};
let downloadResponse;
try {
downloadResponse = await axios.post("https://hub.ytconvert.org/api/download", payload, { headers });
} catch (err) {
downloadResponse = await axios.post("https://api.ytconvert.org/api/download", payload, { headers });
}
let statusUrl = downloadResponse.data.statusUrl;
let finalData = null;
while (!finalData) {
const statusCheck = await axios.get(statusUrl, { headers });
if (statusCheck.data.status === "completed" || statusCheck.data.status === "finished" || statusCheck.data.downloadUrl) {
finalData = statusCheck.data;
} else if (statusCheck.data.status === "failed") {
throw new Error("Conversion failed");
} else {
await new Promise(res => setTimeout(res, 2000));
}
}
return {
title: finalData.title || "YouTube Media",
downloadUrl: finalData.downloadUrl,
format: format,
quality: quality
};
} catch (err) {
console.error("Error:", err.message);
return null;
}
}
// MP3
ytdl('https://youtu.be/WVl0eohFnhc?si=AJ62j6DZ6FB-S56Q', 'mp3', '128k').then(res => console.log(res));
// MP4
// ytdl('https://youtu.be/WVl0eohFnhc?si=AJ62j6DZ6FB-S56Q', 'mp4', '720p').then(res => console.log(res));
// Result
{
title: 'PARAMANU (පරමාණු) - LIL ROME PRABA | OFFICIAL MUSIC VIDEO - 2026',
downloadUrl: 'https://vps-e4198dd8.ytconvert.org/files/AaOxASPgKRCKq8fWGRi8E/output.mp4?token=e3563f2d6be00de963f5159ab55ffbe43397bc00db99dc5142a0c7af843690f7&expires=1771353740',
format: 'mp4',
quality: '720p'
}
{
title: 'PARAMANU (පරමාණු) - LIL ROME PRABA | OFFICIAL MUSIC VIDEO - 2026',
downloadUrl: 'https://vps-c80682fb.ytconvert.org/files/VVDI-MVEJ0-RQBTNA7MF2/output.mp3?token=f5aa98e650109df052aba3a7ed29f7f842c4771b56615f25332d41ab97f0a926&expires=1771353749',
format: 'mp3',
quality: '128k'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment