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

node-raspar

v1.2.6

Published

Easily scrap the web for torrent and media files.

Downloads

72

Readme

Easily scrap the web for torrent and media files.

downloads raspar CI

Getting Started

Raspar exports a resolver function which accepts the configuration object as an argument and returns promises for all available methods.

Installation

To use Raspar in your project, run:

npm i node-raspar

Usage

Raspar follows the latest maintenance LTS version of Node and v14.x or greater is recommended.

Configuration

NOTE: You can use any promise based cache store engine from this list, raspar uses fs-hash by default.

const options = {
	driver: "1337x", // default: zippyshare
	perPage: 12, // results per page (default: 10)
	cache: { options: { ttl: 60 * 8 } }, // to disable caching set to "false"
};

Example 1 - get a list of music files (using the zippyshare driver)

// initialize by passing a custom options
// or leave empty for default
const raspar = require("node-raspar")(options);

// when using zippyshare driver
// you need to pass a genre as the second argument to the list method
// calling it without passing the genre returns a list of available genres
const page = 1;
const genre = "Hip Hop";

raspar.list(page, genre).then(console.log).catch(console.error);

Example 2 - search for torrent files (using the 1337x driver)

const raspar = require("node-raspar")(options);

(async () => {
	const page = 1;
	const keyword = "avengers";

	const results = await raspar.search(keyword, page);
	console.log(results);
})();

Available Drivers and Methods

| Drivers | Type | Search (query, page) | List (page) | | ---------- | --------- | -------------------- | ------------------ | | Zippyshare | Music | :white_check_mark: | :white_check_mark: | | 1337x | Torrent | :white_check_mark: | :white_check_mark: | | Netnaija | Movie | :white_check_mark: | :white_check_mark: | | Zoro | Anime | :white_check_mark: | :white_check_mark: |

Running / Deploying the API

This is the first step if you're trying to either run it with or without using docker In terminal run the following commands to get the code on your machine.

# first clone the repo
$ git clone https://github.com/kodjunkie/node-raspar.git raspar
# change directory
$ cd raspar
# chmod the cache directory
$ sudo chmod -R 777 temp/

Without Docker

Run these additional commands

# install dependencies
$ npm install
# start the server
$ npm start

With Docker

Run these additional commands

# build the container
$ docker build -t raspar-api .
# run the container mapping the ports
$ docker run --name raspar -it -p 3000:3000 raspar-api

With Docker Compose

Run these additional commands

# to boot-up first time only
# or whenever docker file is modified (builds the container)
$ docker compose up --build
# to boot-up without building the container (regular use)
$ docker compose up
# to shut-down
$ docker compose down

# Solutions to problems you might encounter with docker compose
#
# NOTE: Before you run any of the solutions below, you first need access to the rasper shell.
# to gain access to the shell, open a new terminal window and run
$ docker exec -it raspar bash
#
# to exit raspar shell, run (optional)
$ exit
#
# Problem 1: you might get module loading errors
# once in the raspar shell, run
$ npm install
#
# Problem 2: you might get "Could not locate (chrome) locally" error
# this happens when npm doesn't run puppeteer's post install script successfully
# once in the raspar shell, run
$ node ./node_modules/puppeteer/install.js

Deploying on Heroku

Heroku requires some additional dependencies that aren't included on the Linux box that Heroku spins up for you. To add the dependencies on deploy, add the Puppeteer Heroku buildpack to the list of buildpacks for your app under Settings > Buildpacks.

The url for the buildpack is https://github.com/CoffeeAndCode/puppeteer-heroku-buildpack

API Documentation

NOTE: localhost refers to the address your server is running on. By default, it runs on port 3000

Swagger: http://localhost:3000/docs

Liked it?

Hope you liked this project, don't forget to give it a star ⭐

Tests

$ npm test

# or via docker
$ docker exec -it raspar npm test

License

This project is opened under the MIT 2.0 License which allows very broad use for both academic and commercial purposes.