chama-yt-scraper
v1.1.0
Published
Powerful YouTube scraper for metadata and MP3/MP4 streaming links without external APIs.
Maintainers
Readme
YouTube Scraper (Chama Edition) 🚀
A lightweight and powerful YouTube scraper that extracts video metadata and direct download links (MP3/MP4) by directly scraping YouTube's official watch page and InnerTube API. No third-party APIs or external services are used.
Features
- Direct Scraping: Scrapes directly from YouTube for high reliability.
- No External APIs: Does not rely on Savetube, Y2Mate, or other external sites.
- Full Metadata: Get Title, Description, Views, Author, and high-quality Thumbnails.
- Direct URLs: Returns direct streaming URLs for MP3 (Audio) and MP4 (Video).
- Search Support: Can search for videos by name.
Installation
npm install chama-yt-scraperUsage
Using URL or Search Query
const yt = require('chama-yt-scraper');
// Get info using URL or Search Query
yt.download('Lelena Nilan Hettiarachchi')
.then(res => {
console.log(res);
})
.catch(err => {
console.error(err);
});Response Format (JSON)
{
"status": true,
"creator": "@CHAMA OFC",
"data": {
"title": "Video Title",
"url": "https://youtube.com/watch?v=...",
"downloads": [
{
"quality": "medium",
"format": "mp4",
"url": "DIRECT_STREAMING_URL"
}
]
}
}WhatsApp Bot Integration (Example)
If you are using this in a WhatsApp bot (e.g., Baileys), here is how you can use it inside a switch case:
case 'song': {
const yt = require('chama-yt-scraper');
try {
const query = args.join(" ");
const res = await yt.download(query);
if (!res.status) return reply("❌ Song not found!");
await conn.sendMessage(from, {
audio: { url: res.data.downloads[0].url },
mimetype: 'audio/mpeg'
}, { quoted: msg });
} catch (e) {
reply("❌ Error: " + e.message);
}
break;
}Note
YouTube streaming URLs are temporary and may expire after 6 hours. They are sometimes locked to the IP address that requested them.
License
ISC
