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 🙏

© 2024 – Pkg Stats / Ryan Hefner

aniwave-scraper

v1.0.1

Published

a simple anime scraper for aniwave website

Downloads

118

Readme

Aniwave Scraper

aniwave-scraper is a simple npm package that scrapes anime related data from aniwave website

NPM

Installation

npm install aniwave-scraper

Functions

# animeInfo (url)

fetches meta information about a particular anime

below is the information object structure that is returned

NOTE: some properties may not be returned

{
    meta: {
            title: string,
            jptitle: string,
            names: string[],
            description: string,
            poster: string,
            aired: {
                premiered: string,
                date_aired: string,
                broadcast: string,
                status: string
            },
            type: string,
            country: string,
            genres: string[],
            mal: string,
            duration: string,
            episodes: number,
            studios: string,
            producers: string[]
    },
    related: {
        relation: string,
        title: string,
        jptitle: string,
        poster: string,
        url: string,
        type: string,
        plays: string,
        bookmarks: string
    }
}

# animeSearch (name)

searches for animes with the specified name and returns a list

below are the accessible properties for every item that exists in the list

{
    title: string,
    jptitle: string,
    url: string,
    poster: string,
    total_episodes: {
        sub: number,
        dub: number,
        total: number
    },
    type: string
}

# recentRelease (type, page)

returns list of animes that have been released as of recent

{
    title: string,
    jptitle: string,
    url: string,
    poster: string,
    total_episodes: {
        sub: number,
        dub: number,
        total: number
    },
    type: string
}

accepted parameters

  1. Type: below are the accepted types

    all / sub / dub / china / trending / random

  2. Page: page number (1, 2, 3,....)

# topAnime (duration)

returns list of top animes of the day, week or month

{
    title: string,
    jptitle: string,
    url: string,
    poster: string,
    total_episodes: {
        sub: number,
        dub: number,
        total: number
    },
    type: string,
    rank: number
}
  1. Duration: day / week / month

Examples

let's look at a couple of examples

tried making it as beginner friendly as possible

Searching for an Anime

const AniwaveScraper = require("aniwave-scraper").default
const aniwave = new AniwaveScraper

const name = "solo leveling"

aniwave.animeSearch(name).then((animes) => {
    console.log(`There are ${animes.length} results for ${name}`)
    console.log(animes)
})

example output: some outputs shown here are purseposefully incorrect and only meant for the sake of example. the package won't actually return incorrect information

There are 2 results for solo leveling
[
  {
    title: 'Solo Leveling',
    jptitle: 'Ore dake Level Up na Ken',
    url: 'https://aniwave.to/watch/solo-leveling',
    poster: 'https://static.aniwave.to/i/b/b1/solo-leveling-poster.jpg',
    total_episodes: { sub: 12, dub: 12, total: 12 },
    type: 'TV'
  },
  {
    title: 'Solo Leveling: How to Get Stronger',
    jptitle: 'Ore dake Level Up na Ken',
    url: 'https://aniwave.to/watch/ore-dake-level-up-na-ken-recap',
    poster: 'https://static.aniwave.to/i/d/d5/solo-leveling-how-to-get-stronger-poster.jpg',
    total_episodes: { sub: 1, dub: 0, total: 1 },
    type: 'SPECIAL'
  }
]

then to access the properties

console.log(`result 1 = ${animes[0].title}`)
console.log(`episodes = ${animes[0].total_episodes.total}`)

console.log(`result 2 = ${animes[1].title}`)
console.log(`episodes = ${animes[1].total_episodes.total}`)

which would output

result 1 = Solo Leveling
episodes = 12
result 2 = Solo Leveling: How to Get Stronger
episodes = 1

the above example should provide a basic idea so i wont include any more outputs as it's pretty straightforward

Fetch Recently Released Animes

type : all | sub | dub | china | trending | random

page : 1, 2, 3, 4,....

aniwave.recentRelease("all", 1).then((animes) => {
    console.log(animes)
})

another example with type - china and page - 5

aniwave.recentRelease("china", 5).then((animes) => {
    console.log(animes)
})

Fetch Top Ranking Animes

duration : day | week | month

returns top anime list of the day

aniwave.topAnime("day").then((animes) => {
    console.log(animes)
})

returns top anime list of the week

aniwave.topAnime("week").then((animes) => {
    console.log(animes)
})

returns top anime list of the month

aniwave.topAnime("month").then((animes) => {
    console.log(animes)
})

Get details on Specific Anime

aniwave.animeInfo("https://aniwave.to/watch/solo-leveling.3rpv2").then((anime) => {
    console.log(anime)
})

animeInfo method returns a ton of metadata properties depending upon the anime being scraped

do check the Functions section above for whole list

Search Anime + Get Details

now let's try searching for an anime and then fetch the data for one of the results

const name = "Solo Leveling"

aniwave.animeSearch(name).then((animes) => {
    aniwave.animeInfo(animes[0].url).then((anime) => {
        console.log(anime)
    })
})

with this we fetch the url of anime on first index of search result and use it to fetch details about that anime

Conclusion

Upcoming Changes?

  • [x] temporary errors handled
  • [ ] more error handling?
  • [ ] #getEpisodes function
  • [ ] return genres on searchAnime (i got bored and forgor 💀)

I'm not sure how often i'll be updating this or at all even so feel free to pull request on my github if you're interested I'll prolly accept as long as it's a meaningful addition