@paiavaliable/scrape-lib
v1.1.1
Published
Kumpulan scraper/downloader utility: YT Music search, YT downloader, AIO social media downloader, link bypass, HD image upscaler, black & white image filter.
Maintainers
Readme
@yourname/scrape-lib
Ganti
@yournamedipackage.jsondengan scope npm lo sendiri sebelum publish.
Kumpulan scraper/downloader utility buat WhatsApp bot / project Node.js lain.
Install
npm i @yourname/scrape-libUsage
const scrape = require('@yourname/scrape-lib');searchSongs(query, opts?)
Cari lagu di YouTube Music.
const list = await scrape.searchSongs('love story');
console.log(list);
// [{ type, videoId, url, name, artist, album, duration, thumbnails }, ...]opts: { GL, HL, cookies } (opsional — region/language code & cookie string).
toHitam(input)
Filter gambar jadi hitam-putih.
// dari URL
const res = await scrape.toHitam('https://example.com/foto.jpg');
// dari Buffer
const res2 = await scrape.toHitam({ buffer: mediaBuffer, mimetype: 'image/jpeg' });
console.log(res.url); // URL gambar hasil filtergetXInfo(url)
Ambil metadata post X/Twitter (title, thumbnail, videoUrl, mediaType).
const info = await scrape.getXInfo('https://x.com/user/status/xxxxxxxxxxx');
console.log(info);
// { platform, title, description, videoUrl, thumbnail, mediaType, originalUrl }downloadX(url, outputDir?)
Download video dari post X/Twitter ke disk. Kalo cuma butuh URL video buat dikirim ulang (misal via WA), cukup pake getXInfo(url).videoUrl langsung tanpa nge-download.
const res = await scrape.downloadX('https://x.com/user/status/xxxxxxxxxxx');
console.log(res.filePath);SakanaAI
Unofficial client buat chat.sakana.ai (auto bikin sesi anonim, streaming chat).
const { SakanaAI } = require('@yourname/scrape-lib');
const ai = new SakanaAI();
const models = await ai.getModels(); // ['namazu', 'sakana', ...]
const res = await ai.chat('Halo, apa kabar?', {
model: 'namazu',
needSearch: 0, // 1 buat aktifin web search
thinking: 0 // 1 buat aktifin reasoning mode (nggak bisa bareng needSearch)
});
console.log(res.text, res.conversationId);
// Lanjutin percakapan yang sama:
const res2 = await ai.chat('Terus gimana?', {
conversationId: res.conversationId,
parentMessageId: res.parentMessageId
});anilistPopuler()
Ambil daftar anime trending, populer, upcoming, top dari homepage AniList.
const data = await scrape.anilistPopuler();
console.log(data.trending, data.top);anilistSearch(query)
Cari anime di AniList.
const results = await scrape.anilistSearch('one piece');anilistDetail(url)
Detail lengkap anime (translated ke ID) dari URL halaman AniList.
const detail = await scrape.anilistDetail('https://anilist.co/anime/21/ONE-PIECE/');translate(text, lang?)
Translate teks pendek (default ke id).
const res = await scrape.translate('Hello world');
console.log(res.result.tr);ambilRepost(username, jumlah?, cursor?)
Ambil satu halaman video repost dari akun TikTok (default 6 video).
const res = await scrape.ambilRepost('dimeh493');
console.log(res.videos, res.adaLagi, res.cursor);ambilSemuaRepost(username, maxHalaman?)
Ambil semua repost sampe maxHalaman halaman (default 5) atau sampe habis.
const res = await scrape.ambilSemuaRepost('dimeh493', 3);
console.log(res.totalVideo);savefrom(url)
AIO downloader (hampir semua platform video) via savefrom.net.
const res = await scrape.savefrom('https://www.tiktok.com/@user/video/xxxx');
console.log(res[0].video, res[0].audio);IDN Times (search_it, get_news, read_article, get_live_cats, get_streams, stream_detail)
Scraper berita & livestream IDN Times.
const results = await scrape.search_it('pemilu 2029');
const news = await scrape.get_news('news/indonesia'); // atau 'tekno'
const article = await scrape.read_article(results[0].url);
console.log(article.title, article.body);
const streams = await scrape.get_streams();
const detail = await scrape.stream_detail(streams[0].slug);Spotify (spotifySearch, spotifyInfo, spotifyDownload)
Via api.theresav.biz.id — beberapa endpoint mungkin butuh apikey (param opsional).
const results = await scrape.spotifySearch('Selamat Tinggal');
const info = await scrape.spotifyInfo(results.result[0].spotifyUrl); // termasuk lirik
const dl = await scrape.spotifyDownload(results.result[0].spotifyUrl);
console.log(dl.result.downloadUrl);getFbInfo(url) / downloadFb(url, outputDir?)
Download video Facebook (HD/SD).
const info = await scrape.getFbInfo('https://www.facebook.com/xxx/videos/xxxx');
console.log(info.downloadUrl, info.quality); // 'HD' atau 'SD'upscaleImage(input, opts?)
Upscale gambar 2x/4x via imageupscaler.com (alternatif dari hdImage).
// dari path lokal
const res = await scrape.upscaleImage('./foto.jpg', { scale: '4x' });
// dari Buffer (reply WA)
const buffer = await q.download();
const res = await scrape.upscaleImage(buffer, { scale: '2x', filename: 'foto.jpg', mimetype: 'image/jpeg' });
console.log(res.upscaled); // URL hasiluploadFile(input, opts?)
Upload file/media (path lokal atau Buffer), dapetin URL publik-nya.
// dari path lokal
const res = await scrape.uploadFile('./menu.png');
// dari Buffer (reply WA)
const buffer = await q.download();
const res = await scrape.uploadFile(buffer, { filename: 'foto.jpg' });
console.log(res.url); // URL publik hasil uploadsearchYoutube(query, apikey?)
Cari video YouTube (via api.theresav.biz.id).
const results = await scrape.searchYoutube('astaga bercanda slowed', apikey);
console.log(results[0].title, results[0].link);ytmp3(url, apikey?)
Convert video YouTube ke mp3 (via api.theresav.biz.id).
const res = await scrape.ytmp3('https://www.youtube.com/watch?v=xxxxxxxxxxx', apikey);
console.log(res.download_url, res.title);searchCapcut(query, apikey?)
Cari template CapCut (video preview + template link siap pake).
const results = await scrape.searchCapcut('JJ kece', apikey);
console.log(results[0].title, results[0].video_url, results[0].template_url);searchStickerly(query, apikey?)
Cari sticker pack di Stickerly.
const results = await scrape.searchStickerly('Wowo', apikey);
console.log(results[0].name, results[0].url, results[0].stickerCount);downloadTeleSticker(url, apikey?)
Ambil semua sticker dari link Telegram sticker pack.
const pack = await scrape.downloadTeleSticker('https://t.me/addstickers/xuan_sol_by_fStikBot', apikey);
console.log(pack.title, pack.stickers.length);
console.log(pack.stickers[0].image_url); // .webp (static) atau .webm (animated)Catatan
Semua fungsi di sini nge-hit API/service pihak ketiga (bukan self-hosted), jadi:
- Bisa aja berhenti kerja kalo service-nya berubah/down — bukan bug di package ini.
- Jangan spam request berlebihan ke service-service tersebut.
License
MIT
