npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@duyquangnvx/story-spider

v2.0.2

Published

A TypeScript library for scraping stories from various Vietnamese websites

Readme

Story Spider

Story Spider is a TypeScript library for scraping stories from popular Vietnamese story websites like truyenyy.vn, truyenfull.vn, etc. It features a modular architecture that makes it easy to add support for additional websites.

Features

  • Collect story information (title, description, author, genre, status, total chapters)
  • Get chapter lists with details
  • Retrieve chapter URLs by chapter number
  • Get chapter content in HTML or text format
  • Intelligent content cleaning with html-to-text integration
  • Advanced caching for reduced bandwidth and faster performance
  • Rate limiting to avoid overloading servers
  • Extensible adapter system for supporting multiple websites

Installation

npm install story-spider

Environment Variables

For authenticated websites (metruyencv.com), set up environment variables:

# Metruyencv authentication
export METRUYENCV_EMAIL="[email protected]"
export METRUYENCV_PASSWORD="your-password"

Or create a .env file:

[email protected]
METRUYENCV_PASSWORD=your-password

Usage

Basic Usage

import { StorySpider } from 'story-spider';

// Create story spider
const storySpider = new StorySpider({
    rateLimiterOptions: {
      minTime: 1000,
      maxConcurrent: 1,
    }
});

// Default scrapers are registered automatically:
// - TruyenfullScraper, RungtruyenScraper, XalosachScraper, MailinhwpScraper, MetruyencvScraper

// Get story information (works with any supported website)
const storyInfo = await storySpider.scrapeStoryInfo('https://rungtruyen.com/category/tien-hiep/quang-am-chi-ngoai/');
console.log(storyInfo);

// Get chapter list
const chapters = await storySpider.scrapeChapterList('https://rungtruyen.com/category/tien-hiep/quang-am-chi-ngoai/');
console.log(chapters);

// Get chapter content
const chapterContent = await storySpider.scrapeChapterContent(chapterUrl);
console.log(chapterContent);

Creating a Custom Scraper

You can create your own scraper for any website by extending the StoryScraper class:

import { StoryScraper, StoryInfo, ChapterInfo } from 'story-spider';

export class CustomScraper extends StoryScraper {
  getSiteIdentifier(): string {
    // Implementation for getting site id
  }

  getSupportedDomains(): string[] {
    // Implementation for getting supported domains
  }

  canHandle(url: string): boolean {
    // Implementation for check if url can handle
  }

  async scapeStoryInfo(storyUrl: string): Promise<StoryInfo> {
    // Implementation for getting story info
  }

  async scapeChapterList(storyUrl: string): Promise<ChapterInfo[]> {
    // Implementation for getting chapter list
  }

  async scapeChapterContent(chapterUrl: string): Promise<string> {
    // Implementation for getting chapter content
  }
}

// Register the scraper
storySpider.registerScraper(new CustomScraper());

Using Authenticated Scrapers (Metruyencv)

For websites that require authentication like metruyencv.com, simply set environment variables and use StorySpider normally:

# Set environment variables
export METRUYENCV_EMAIL="[email protected]"
export METRUYENCV_PASSWORD="your-password"
import { StorySpider } from 'story-spider';

// Create story spider (Metruyencv scraper is registered automatically)
const storySpider = new StorySpider({
    rateLimiterOptions: {
      minTime: 2000, // Recommended for authenticated sites
      maxConcurrent: 1,
    }
});

// Use normally - authentication happens automatically
const storyInfo = await storySpider.scrapeStoryInfo('https://metruyencv.com/truyen/example-story/');
const chapters = await storySpider.scrapeChapterList('https://metruyencv.com/truyen/example-story/');

if (chapters.length > 0) {
    const chapterContent = await storySpider.scrapeChapterContent(chapters[0].url);
    console.log(chapterContent);
}

Testing

# Test with specific scrapers
npm run test:truyenfull
npm run test:rungtruyen
npm run test:xalosach
npm run test:mailinhwp

# Test Metruyencv (requires environment variables)
export METRUYENCV_EMAIL="[email protected]"
export METRUYENCV_PASSWORD="your-password"
npm run test:story-spider-metruyencv

Supported Websites

  • Truyenfull (truyenfull.vn, truyenfull.com, truyenfull.vision, truyenfull.vip)
  • Rungtruyen (rungtruyen.com)
  • Metruyencv (metruyencv.com) - Requires authentication

Additional website scrapers can be implemented separately or contributed to this project.

Dependencies

  • html-to-text: For advanced HTML content cleaning
  • axios: For network requests
  • cheerio: For HTML parsing
  • winston: For logging
  • node-cache: For caching
  • playwright: For browser automation (authenticated scrapers)
  • crawlee: For advanced web scraping capabilities

License

ISC