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 🙏

© 2026 – Pkg Stats / Ryan Hefner

wattpad-scraper

v1.0.9

Published

A Node.js library for scraping Wattpad stories and content

Downloads

19

Readme

Wattpad Scraper

A powerful Node.js library for scraping Wattpad stories, chapters, and search results. This package provides an easy-to-use interface for accessing Wattpad content programmatically.

Installation

npm install wattpad-scraper

To update:

npm install wattpad-scraper@latest

Features

  • 📖 Read story chapters (with multi-page support)
  • 📑 Get all parts/chapters of a story
  • 🔍 Search for stories
  • ⚡ Promise-based API
  • 🔄 CommonJS and ES Module support
  • 📘 TypeScript support

Usage

JavaScript (CommonJS)

 const WattpadScraper = require('wattpad-scraper');

const scraper = new WattpadScraper();

// Read a chapter (including all pages)
async function readChapter() {
  try {
    const initialUrl = 'https://www.wattpad.com/1362020763-hell-university-chapter-01';
    const pages = await scraper.read(initialUrl);

    pages.forEach(page => {
      console.log(`Page ${page.pageNumber}: ${page.url}`);
      console.log(page.content + "\n");
    });
  } catch (error) {
    console.error('Error:', error.message);
  }
}
  

// Get all parts of a story
async function getStoryParts() {
  try {
    const parts = await scraper.getParts('https://www.wattpad.com/story/346558088-hell-university');
    parts.forEach((part, index) => {
      console.log(`${index + 1}. ${part.title}`);
      console.log(`   Link: ${part.link}`);
    });
  } catch (error) {
    console.error('Error:', error.message);
  }
}

// Search for stories
async function searchStories() {
  try {
    const stories = await scraper.search('Hell University');
    stories.forEach((story, index) => {
      console.log(`\n${index + 1}. ${story.title}`);
      console.log(`Author: ${story.author}`);
      console.log(`Thumbnail: ${story.thumbnail}`);
      console.log(`Link: ${story.link}`);
      console.log(`Reads: ${story.reads}`);
      console.log(`Votes: ${story.votes}`);
      console.log(`Parts: ${story.parts}`);
      console.log(`Description: ${story.description}`);
    });
  } catch (error) {
    console.error('Error:', error.message);
  }
}

// Example usage
readChapter();
getStoryParts();
searchStories();

TypeScript

 import WattpadScraper from 'wattpad-scraper';

const scraper = new WattpadScraper();

async function readChapter(): Promise<void> {
  try {
    const pages = await scraper.read('https://www.wattpad.com/1362020763-hell-university-chapter-01');
    pages.forEach(page => {
      console.log(`\nPage ${page.pageNumber}:`);
      console.log(`URL: ${page.url}`);
      console.log(`Content: ${page}`);
    });
  } catch (error) {
    console.error('Error:', (error as Error).message);
  }
}

async function getStoryParts(): Promise<void> {
  try {
    const parts = await scraper.getParts('https://www.wattpad.com/story/346558088-hell-university');
    parts.forEach((part, index) => {
      console.log(`${index + 1}. ${part.title}`);
      console.log(`   Link: ${part.link}`);
    });
  } catch (error) {
    console.error('Error:', (error as Error).message);
  }
}

async function searchStories(): Promise<void> {
  try {
    const stories = await scraper.search('Hell University');
    stories.forEach((story, index) => {
      console.log(`\n${index + 1}. ${story.title}`);
      console.log(`Author: ${story.author}`);
      console.log(`Thumbnail: ${story.thumbnail}`);
      console.log(`Link: ${story.link}`);
      console.log(`Reads: ${story.reads}`);
      console.log(`Votes: ${story.votes}`);
      console.log(`Parts: ${story.parts}`);
      console.log(`Description: ${story.description}`);
    });
  } catch (error) {
    console.error('Error:', (error as Error).message);
  }
}

// Example usage
readChapter();
getStoryParts();
searchStories();

API Reference

read(url: string): Promise<Array<{pageNumber: number, url: string, content: string}>>

Reads the content of a specific Wattpad story chapter, including all available pages.

  • url: The URL of the chapter to read

  • Returns: Promise resolving to an array of page objects, each containing:

  • pageNumber: The page number

  • url: The URL of the specific page

  • content: The text content of the page

getParts(url: string): Promise<Array<{title: string, link: string}>>

Gets all parts/chapters of a Wattpad story.

  • url: The URL of the story's main page
  • Returns: Promise resolving to an array of story parts with title and link properties

search(query: string): Promise<Array<{title: string, author: string, link: string, thumbnail: string, reads: string, votes: string, parts: string, description: string}>>

Searches for stories on Wattpad.

  • query: The search query

  • Returns: Promise resolving to an array of found stories with properties:

  • title: Story title

  • author: Author username

  • link: Story URL

  • thumbnail: Cover image URL

  • reads: Number of reads

  • votes: Number of votes

  • parts: Number of parts

  • description: Story description

License

MIT © Deku

Author

Created by Deku