Catalog npm
Back to packageRELEASE DETAILS

1.0.3

npm

4anime-scraper

A web scraper for 4anime.to

Published10 Nov 2020
Direct dependencies3
Transitive dependenciesNot calculated

README

Current package documentation

4anime Web scraper

This anime web scraper uses the 4anime.to website to get data of any anime available on the platform.

The data includes the name, the genres, the description, the type of show, the studio that produced the show, the release date, the status- i.e. completed or ongoing-, the language- i.e. subbed or dubbed, the url of the page, and the episodes.

The episodes have the following information: the episode id, the episode number, and the episode url.

Installation

npm install 4anime-scraper

Information

Anime object structure

Anime {
  name: string,
  genres: array of strings,
  description: string,
  imageUrl: string,
  type: string,
  studio: string,
  releaseDate: string,
  status: string,
  language: string,
  url: string,
  episodes: array of objects
}

Episode object structure

    {
      id: int,
      episode: int,
      url: string
    }

Usage

There are two functions to this package. One takes in a string and returns a list of all anime that came from the search result. The other takes in a url to the anime page and returns all the data regarding that page alone.

Getting data from url

Anime.getAnimeFromURL("https://4anime.to/anime/the-god-of-high-school")
	.then(res => {
		console.log(res);
	});

Sample response

Anime {
  name: 'The God of High School',
  genres: [
    'Action',
    'Adventure',
    'Comedy',
    'Fantasy',
    'Martial Arts',
    'Sci-Fi',
    'Supernatural'
  ],
  description: 'It all began as a fighting tournament to seek out for the best fighter among all high school students in Korea. Mori Jin, a Taekwondo specialist and a high school student, soon learns that there is something much greater beneath the stage of the tournament.',
  type: 'TV Series',
  studio: 'MAPPA',
  releaseDate: 'Summer, 2020',
  status: 'Currently Airing',
  language: 'Subbed',
  url: 'https://4anime.to/anime/the-god-of-high-school',
  episodes: [
    {
      id: 42172,
      episode: 1,
      url: 'https://4anime.to/the-god-of-high-school-episode-01/?id=42172'
    },
    {
      id: 42546,
      episode: 2,
      url: 'https://4anime.to/the-god-of-high-school-episode-02/?id=42546'
    },
    {
      id: 42710,
      episode: 3,
      url: 'https://4anime.to/the-god-of-high-school-episode-03/?id=42710'
    },
    {
      id: 42822,
      episode: 4,
      url: 'https://4anime.to/the-god-of-high-school-episode-04/?id=42822'
    },
    {
      id: 42950,
      episode: 5,
      url: 'https://4anime.to/the-god-of-high-school-episode-05/?id=42950'
    }
  ]
}
const Anime = require('4anime-scraper').default;

Anime.getAnimeFromSearch("enen no shouboutai")
	.then(res => {
		console.log(res);
	});
const Anime = require('4anime-scraper').default;

Anime.getVideoLinkFromUrl("https://4anime.to/one-piece-episode-938?id=43181")
	.then(res => {
		console.log(res);
	});
Anime.getOngoingLinks()
  .then(res => {
    console.log(res);
  });

This function takes in the video link returned from the getVideoLinkFromURL() function and downloads the video either in current working directory of the .js file or a given path.

// No given path
Anime.downloadVideoFromLink("https://storage.googleapis.com/justawesome-183319.appspot.com/v2.4animu.me/Higurashi-no-Naku-Koro-ni-Gou/Higurashi-no-Naku-Koro-ni-Gou-Episode-04-1080p.mp4")

// With a given path
Anime.downloadVideoFromLink("https://storage.googleapis.com/justawesome-183319.appspot.com/v2.4animu.me/Higurashi-no-Naku-Koro-ni-Gou/Higurashi-no-Naku-Koro-ni-Gou-Episode-04-1080p.mp4", "./test")

Changes

  • Fixed "undefined" TypeError in getAnimeFromURL

Contribution

If you would like to add to this package please feel free to send in a pull request.

Contributors

  • Bondiiisan
  • tshrpl

Other

If you would like to check out the code there will be a link to the github page.

Thanks for checking out this package.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 3

Native requirements
3 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
axios
Environment
{
  "local_name": "axios",
  "alias": false,
  "peer_metadata": null
}
^0.19.2runtime
cheerio
Environment
{
  "local_name": "cheerio",
  "alias": false,
  "peer_metadata": null
}
^1.0.0-rc.3runtime
nodemon
Environment
{
  "local_name": "nodemon",
  "alias": false,
  "peer_metadata": null
}
^2.0.4development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "integrity": "sha512-aT0I5S55ENl7IwKnkJJnpTMML2b8K/pbBNiuLeV184Rk6kYraA7agsqGk9AphzNoXmcGnB/S9Zf8KoAa/VZs5w==",
  "shasum": "dfb0e6cb272bd0d0f7a4ed14083a721c3235e3e5",
  "tarball": "https://registry.npmjs.org/4anime-scraper/-/4anime-scraper-1.0.3.tgz",
  "fileCount": 5,
  "unpackedSize": 12809,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfqrXBCRA9TVsSAnZWagAAwqwP/jOfqv6v3urJgTN9TAJ/\nFA3y0IzKIqIord2X6yQ3PCbaBAZ+25xAumFgF+V0ggaBimw7oXQSxbfAwUUM\nkwShTA10CLtZJnXTs2v0CWomAB/bTlcYNQRrlzM2YZP3lndLv08liEUnojm1\nwZc1pfyfnwED0j9TTdj/RH5juLkxQdDZ2pHhN2nt8mAuLrZZ+Q43carD7tv0\n6zCYmglyMClGbsYtvuGpfT8+H8t/cR6IKgInvJIMsnj84hYvQFElgsJllQlR\nZpBLxmx8A72aKHY+Pr5REpCNoIEqYf4i1QTRQVOFvIxrbrbvdIjcuBeT7b3/\nEoiOIVznuXqDRbsd1fHxQ/Z2NgpCursCcGv1iFYpvcdjr0Mcg2b7eFw2+r2a\n7tr+ul26nC3PxcafKNMYkQ+zic6vqxh2v8WB/HMRuiOXVpq92QAKJ6VyoECZ\nl0a2uOpLjwCdjfd63h1A+AIWB7y/Dq3dpGxIoz2gP08qmBY3QPu8sD9Jy6J4\nV0jHYLrHDdy2gVKkHiTgmujwqaBsJ0I4q2Bz1EtaJQlxSEl4whVackoiGu6H\neWTvpAI4e16XyOj0WE1acSaS7cxMtS8qrbHDzDrK5Vzd+C4FERzjeWRLmCWt\njpFbshjsjXlgp9aJiXZuDVCpAxrxHbJj4JxS4oC/Q2PpScDYK5Gu2lu0C480\nh5sP\r\n=He3X\r\n-----END PGP SIGNATURE-----\r\n",
  "signatures": [
    {
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
      "sig": "MEUCIQC89ESrtjtpr9XJmJbeo0isNVGx2251aGw/fsMw/5ni3QIgZtvaV/p7fGzIbGJNh1ot/vrlJs69lI0R5PjyHBsmGMA="
    }
  ]
}

Repository

PENDING
tarunm20/4anime-scraper

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 20:04 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:da18cc819991b8626fc085eb1f34ee6749fd2f6eccc2c0a8a6fc6423f4d641cd

Other collected versions

1.0.526 May1.0.426 May1.0.224 Aug1.0.16 Aug1.0.06 AugView all collected versions →