Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kodjunkie/node-raspar
🕷️ Easily scrap the web for torrent and media files.
https://github.com/kodjunkie/node-raspar
api api-rest api-wrapper cli crawler crawling crawling-tool docker expressjs javascript movies mp3 music node-js nodejs scraper series torrent torrent-downloader video
Last synced: 3 months ago
JSON representation
🕷️ Easily scrap the web for torrent and media files.
- Host: GitHub
- URL: https://github.com/kodjunkie/node-raspar
- Owner: kodjunkie
- License: mit
- Created: 2021-06-15T15:09:10.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-12-20T16:04:47.000Z (about 2 years ago)
- Last Synced: 2024-10-08T10:56:29.573Z (4 months ago)
- Topics: api, api-rest, api-wrapper, cli, crawler, crawling, crawling-tool, docker, expressjs, javascript, movies, mp3, music, node-js, nodejs, scraper, series, torrent, torrent-downloader, video
- Language: JavaScript
- Homepage:
- Size: 635 KB
- Stars: 13
- Watchers: 2
- Forks: 7
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
🕷️ Node Raspar
Easily scrap the web for torrent and media files.
[![downloads](https://img.shields.io/npm/dt/node-raspar.svg)](https://www.npmjs.com/package/node-raspar) [![raspar CI](https://github.com/kodjunkie/node-raspar/actions/workflows/node.js.yml/badge.svg?branch=master)](https://github.com/kodjunkie/node-raspar/actions/workflows/node.js.yml)
## 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:
```bash
npm i node-raspar
```### Usage
Raspar follows the latest [maintenance LTS](https://github.com/nodejs/Release#release-schedule) version of Node and v14.x or greater is recommended.
#### Configuration
**NOTE:** You can use any promise based cache store engine from this [list](https://github.com/BryanDonovan/node-cache-manager#store-engines), raspar uses [fs-hash](https://github.com/rolandstarke/node-cache-manager-fs-hash) by default.
```javascript
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)
```javascript
// 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)
```javascript
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 your terminal run the following commands to get the code on your machine.```bash
# 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
```bash
# install dependencies
$ npm install
# start the server
$ npm start
```### With Docker
Run these additional commands
```bash
# 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
```bash
# 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.
```bash
# 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](http://localhost:3000/docs)
## Liked it?
Hope you liked this project, don't forget to give it a star ⭐
## Tests
```bash
$ npm test# or via docker
$ docker exec -it raspar npm test
```## License
This project is opened under the [MIT 2.0 License](https://github.com/kodjunkie/node-raspar/blob/master/LICENSE) which allows very broad use for both academic and commercial purposes.