DEV Community

HEAVSTAL TECH™
HEAVSTAL TECH™

Posted on

I Built an All-in-One Node.js Scraper (ESM + CJS) - @heavstaltech/api

The Problem with Scraping 😫

If you’ve ever tried to build a WhatsApp bot, a Discord bot, or just a simple content downloader, you know the struggle.

  1. You find a library for TikTok, but it’s outdated.
  2. You find a library for YouTube, but ytdl-core is broken (again).
  3. You try to import them, but one is CJS (require) and your project is ESM (import), so Node.js throws errors.

I got tired of hunting for different packages for every single platform. So, I dug up my old scraping codes, modernized them, rewrote them in TypeScript, and bundled them into one powerful "Swiss Army Knife" library.

Introducing @heavstaltech/api 📦

This is a production-ready, multi-purpose API client for Node.js. It handles Social Media Downloading, Media Search, and even AI Image Enhancement.

Why is it special?

  • Hybrid Module: Works out-of-the-box with both import and require. No config needed.
  • Type-Safe: Written in TypeScript with full autocomplete support.
  • Anti-Ban: Includes User-Agent rotation to bypass scraper blocks.
  • AI Powered: Includes tools like Remini (Image Enhancer).

🛠 What can it do?

Here is a quick look at the features packed into this 20KB library:

  1. TikTok: Download Videos (No Watermark) & Slides.
  2. YouTube: Search, MP3 (Audio), and MP4 (Video) downloaders.
  3. Instagram & Facebook: Download Reels, Posts, and public videos.
  4. AI Tools: Enhance blurry photos (Remini) & Style Text.
  5. Utilities: Screenshot websites, fetch Lyrics/Chords, and Wattpad search.

💻 Show me the Code!

Installation is standard:

npm install @heavstaltech/api
Enter fullscreen mode Exit fullscreen mode

1. Downloading TikToks (No Watermark)

Whether you are using require or import, it just works.

import { downloader } from '@heavstaltech/api';

const run = async () => {
  // It automatically detects if it's a URL or a Search Query!
  const video = await downloader.tiktok("https://vt.tiktok.com/ZS...");

  console.log(`Title: ${video.title}`);
  console.log(`Download: ${video.no_watermark}`);
}

run();
Enter fullscreen mode Exit fullscreen mode

2. The YouTube Engine

We use an optimized core to bypass common player restrictions.

import { downloader, search } from '@heavstaltech/api';

// Search and Download in one go
const audio = await downloader.play("No Copyright Sounds", "mp3");

console.log(`Now Playing: ${audio.title}`);
console.log(`Stream URL: ${audio.url}`);
Enter fullscreen mode Exit fullscreen mode

3. AI Image Enhancer (Remini) 🪄

This is my favorite feature. You can pass a URL to a blurry image, and it returns a sharpened buffer.

import { tools } from '@heavstaltech/api';
import fs from 'fs';

const imageBuffer = await tools.remini("https://example.com/blurry.jpg", "enhance");

fs.writeFileSync("hd-image.jpg", imageBuffer);
console.log("Image enhanced! ✨");
Enter fullscreen mode Exit fullscreen mode

🌍 The Heavstal Ecosystem

This package is part of the Heavstal Tech ecosystem. We are building robust tools for the developer community.

Final Thoughts

If you are building a bot or just need a reliable way to grab media, give it a try. I’m actively maintaining it, so if you find a bug or want a new feature, drop an issue on GitHub!

Happy Coding! ⚡️


Drop a ❤️ if you found this useful!

Top comments (0)