├── Procfile
├── .replit
├── .gitignore
├── .gitattributes
├── app.json
├── vercel.json
├── package.json
├── LICENSE
├── torrent
├── ezTV.js
├── magnet_dl.js
├── pirateBay.js
├── bitSearch.js
├── gloTorrents.js
├── zooqle.js
├── nyaaSI.js
├── limeTorrent.js
├── torrentGalaxy.js
├── 1337x.js
├── kickAss.js
├── torLock.js
├── torrentFunk.js
├── torrentProject.js
├── ettv.js
├── rarbg.js
├── yts.js
└── COMBO.js
├── Replit.md
├── README.md
├── app.js
└── index.js
/Procfile:
--------------------------------------------------------------------------------
1 | web: node app.js
--------------------------------------------------------------------------------
/.replit:
--------------------------------------------------------------------------------
1 | language = "nodejs"
2 | run = "npm start"
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | /node_modules
2 | package-lock.json
3 | .netlify
4 | .vscode
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/app.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Torrents APi",
3 | "description": "A torrent Scraping API",
4 | "repository": "https://github.com/Ryuk-me/Torrents-Api",
5 | "logo": "https://node-js-sample.herokuapp.com/node.png",
6 | "keywords": ["node", "express", "static","cheerio","axios"]
7 | }
8 |
--------------------------------------------------------------------------------
/vercel.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": 2,
3 | "env": {},
4 | "builds": [
5 | {
6 | "src": "app.js",
7 | "use": "@vercel/node",
8 | "config": { "includeFiles": ["/torrent/**"] }
9 | }
10 | ],
11 | "routes": [
12 | {
13 | "src": "/api/(.*)",
14 | "dest": "app.js"
15 | },
16 | {
17 | "src": "/",
18 | "dest": "app.js"
19 | },
20 | {
21 | "src": "/arc-sw.js",
22 | "dest": "https://arc.io/arc-sw.js"
23 | }
24 | ]
25 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "TorrentsAPI",
3 | "version": "1.0.0",
4 | "main": "app.js",
5 | "scripts": {
6 | "test": "echo \"Error: no test specified\" && exit 1",
7 | "start": "nodemon app.js",
8 | "start-server": "node app.js"
9 | },
10 | "keywords": [],
11 | "author": "Ryuk_me",
12 | "license": "ISC",
13 | "dependencies": {
14 | "axios": "^0.21.1",
15 | "cheerio": "^1.0.0-rc.3",
16 | "express": "^4.17.1",
17 | "nodemon": "^2.0.4",
18 | "request": "^2.88.2",
19 | "request-promise": "^4.2.6"
20 | },
21 | "devDependencies": {},
22 | "description": ""
23 | }
24 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Neeraj Kumar
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/torrent/ezTV.js:
--------------------------------------------------------------------------------
1 | const cheerio = require('cheerio');
2 | const axios = require('axios');
3 |
4 |
5 | async function ezTV(query) {
6 | let allTorrents = [];
7 | const url = 'https://eztv.re/search/' + query;
8 | let html;
9 | try {
10 | html = await axios.get(url);
11 | } catch{
12 | return null;
13 | }
14 |
15 | const $ = cheerio.load(html.data)
16 |
17 | $('tbody tr').each((_, element) => {
18 |
19 | const url = $(element).find('td').eq(1).find('a').attr('href') || ''
20 | const name = $(element).find('td').eq(1).find('a').text() || ''
21 | if (url !== '' || name !== '') {
22 | let torrent = {
23 | 'Name': name,
24 | 'Size': $(element).find('td').eq(3).text(),
25 | 'DateUploaded': $(element).find('td').eq(4).text(),
26 | 'Seeders': $(element).find('td').eq(5).text() || '',
27 | 'Url': "https://eztv.io" + url,
28 | 'Torrent': $(element).find('td').eq(2).find('a').eq(1).attr('href'),
29 | 'Magnet': $(element).find('td').eq(2).find('a').attr('href')
30 | }
31 | allTorrents.push(torrent)
32 | }
33 | })
34 |
35 | return allTorrents
36 | }
37 |
38 | module.exports = {
39 | ezTV: ezTV
40 | }
41 |
--------------------------------------------------------------------------------
/Replit.md:
--------------------------------------------------------------------------------
1 | ## Run Torrents-Api to Replit and make it still alive
2 |
3 | ## Required
4 | Login/Sign Up to [`Replit`](https://replit.com)
5 |
6 | ## Tutorial
7 |
8 | 1. Give a star and Fork this repo
9 |
10 | 2. Open [`Replit`](https://replit.com)
11 |
12 | 3. Add project
13 |
14 |
15 |
16 |
17 |
18 | 4. Import From Github
19 |
20 |
21 |
22 |
23 |
24 |
25 | 5. Run it
26 |
27 |
28 |
29 |
30 |
31 | 6. Copy the URL
32 |
33 |
34 |
35 |
36 |
37 | 7. Make it alive with ping it everytime, You can use cronjob or anything, In this time i use Cronjob & UptimeRobot
38 |
39 |
40 |
41 |
42 |
43 | **Done!**
44 |
45 | List uptime sites:
46 |
47 | - [`Cron Job`](https://cron-job.org) Just put your link
48 | - [`Uptime Robot`](https://uptimerobot.com) Just put your link
49 | - [`Kaffeine`](https://kaffeine.herokuapp.com) Just put your link
50 | - [`PingDom`](https://pingdom.com) Just put your link
51 | 224 index.js
--------------------------------------------------------------------------------
/torrent/magnet_dl.js:
--------------------------------------------------------------------------------
1 | const cheerio = require('cheerio')
2 | const axios = require('axios')
3 |
4 | async function magnet_dl(query, page = '1') {
5 | var ALLTORRENT = [];
6 | const url = `https://www.magnetdl.com/a/${query}/se/desc/${page}/`;
7 | let html;
8 | try {
9 | html = await axios.get(url, headers = {
10 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36"
11 | });
12 |
13 | } catch {
14 | return null;
15 | }
16 |
17 | const $ = cheerio.load(html.data);
18 |
19 | $('.download tbody tr').each((_, element) => {
20 |
21 |
22 | let torrent = {
23 | 'Name': $(element).find('td').eq(1).find('a').text().trim(),
24 | 'Size': $(element).find('td').eq(5).text(),
25 | 'DateUploaded': $(element).find('td').eq(2).text(),
26 | 'Category': $(element).find('td').eq(3).text(),
27 | 'Seeders': $(element).find('td').eq(6).text(),
28 | 'Leechers': $(element).find('td').eq(7).text(),
29 | 'Url': "https://www.magnetdl.com" + $(element).find('td').eq(1).find('a').attr('href'),
30 | 'Magnet': $(element).find('td').eq(0).find('a').attr('href'),
31 | }
32 | if (torrent.Name !== '') {
33 | ALLTORRENT.push(torrent);
34 | }
35 | })
36 | return ALLTORRENT;
37 | }
38 |
39 | module.exports = magnet_dl
--------------------------------------------------------------------------------
/torrent/pirateBay.js:
--------------------------------------------------------------------------------
1 | const cheerio = require('cheerio')
2 | const axios = require('axios')
3 |
4 | async function pirateBay(query, page = '1') {
5 |
6 | const allTorrents = [];
7 | const url = 'https://thehiddenbay.com/search/' + query + '/' + page + '/99/0';
8 | let html;
9 | try {
10 | html = await axios.get(url);
11 | } catch {
12 | return null;
13 | }
14 | const $ = cheerio.load(html.data)
15 |
16 | $("table#searchResult tr").each((_, element) => {
17 | const data = $(element).find('font.detDesc').text().replace(/(Size|Uploaded)/gi, '').replace(/ULed/gi, 'Uploaded').split(',').map(value => value.trim());
18 | const date = data[0]
19 | const size = data[1]
20 | const uploader = $(element).find('font.detDesc a').text()
21 |
22 | const torrent = {
23 | Name: $(element).find('a.detLink').text(),
24 | Size: size,
25 | DateUploaded: date,
26 | Category: $(element).find('td.vertTh center a').eq(0).text(),
27 | Seeders: $(element).find('td').eq(2).text(),
28 | Leechers: $(element).find('td').eq(3).text(),
29 | UploadedBy: uploader,
30 | Url: $(element).find('a.detLink').attr('href'),
31 | Magnet: $(element).find("td div.detName").next().attr('href')
32 | }
33 |
34 | if (torrent.Name.length) {
35 | allTorrents.push(torrent)
36 | }
37 | })
38 |
39 | return allTorrents
40 | }
41 |
42 | module.exports ={
43 | pirateBay : pirateBay
44 | }
--------------------------------------------------------------------------------
/torrent/bitSearch.js:
--------------------------------------------------------------------------------
1 | const cheerio = require('cheerio')
2 | const axios = require('axios')
3 |
4 |
5 | async function bitSearch(query, page = '1') {
6 | var ALLTORRENT = [];
7 | const url = "https://bitsearch.to/search?q=" + query + "&page=" + page + "&sort=seeders";
8 | let html;
9 | try {
10 | html = await axios.get(url, headers = {
11 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36"
12 | });
13 |
14 | } catch {
15 | return null;
16 | }
17 |
18 | const $ = cheerio.load(html.data);
19 |
20 |
21 | $('div.search-result.view-box').each((_, element) => {
22 | let torrent = {
23 | 'Name': $(element).find('.info h5 a').text().trim(),
24 | 'Size': $(element).find('.info div div').eq(2).text().trim(),
25 | 'Downloads': $(element).find('.info div div').eq(1).text().trim(),
26 | 'Seeders': $(element).find('.info div div').eq(3).text().trim(),
27 | 'Leechers': $(element).find('.info div div').eq(4).text().trim(),
28 | 'DateUploaded': $(element).find('.info div div').eq(5).text().trim(),
29 | 'Url': "https://bitsearch.to" + $(element).find('.info h5 a').attr('href'),
30 | 'TorrentLink': $(element).find('.links a').attr('href'),
31 | 'Magnet': $(element).find('.links a').next().attr('href'),
32 | }
33 | ALLTORRENT.push(torrent);
34 | })
35 |
36 | return ALLTORRENT;
37 | }
38 |
39 |
40 | module.exports = bitSearch;
--------------------------------------------------------------------------------
/torrent/gloTorrents.js:
--------------------------------------------------------------------------------
1 | const cheerio = require('cheerio')
2 | const axios = require('axios')
3 |
4 |
5 | async function glodls(query, page = '0') {
6 | var ALLTORRENT = [];
7 | const url = `https://glodls.to/search_results.php?search=${query}&sort=seeders&order=desc&page=${page}`;
8 | let html;
9 | try {
10 | html = await axios.get(url, headers = {
11 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36"
12 | });
13 |
14 | } catch {
15 | return null;
16 | }
17 |
18 | const $ = cheerio.load(html.data);
19 |
20 |
21 | $('.ttable_headinner tr').each((_, element) => {
22 |
23 |
24 | let torrent = {
25 | 'Name': $(element).find('td').eq(1).find('a').text().trim(),
26 | 'Size': $(element).find('td').eq(4).text(),
27 | 'UploadedBy' : $(element).find('td').eq(7).find('a b font').text(),
28 | 'Seeders': $(element).find('td').eq(5).find('font b').text(),
29 | 'Leechers': $(element).find('td').eq(6).find('font b').text(),
30 | 'Url': "https://glodls.to" + $(element).find('td').eq(1).find('a').next().attr('href'),
31 | 'Torrent': "https://glodls.to" + $(element).find('td').eq(2).find('a').attr('href'),
32 | 'Magnet': $(element).find('td').eq(3).find('a').attr('href'),
33 | }
34 | if (torrent.Name !== '') {
35 | ALLTORRENT.push(torrent);
36 | }
37 | })
38 | return ALLTORRENT;
39 | }
40 | module.exports = glodls
41 |
--------------------------------------------------------------------------------
/torrent/zooqle.js:
--------------------------------------------------------------------------------
1 | const cheerio = require('cheerio')
2 | const axios = require('axios')
3 |
4 |
5 | async function zooqle(query = '', page = '1') {
6 | var ALLTORRENT = [];
7 | const url = "https://zooqle.com/search?pg=" + page + "&q=" + query;
8 | let html;
9 | try {
10 | html = await axios.get(url, headers = {
11 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36"
12 | });
13 |
14 | } catch {
15 | return null;
16 | }
17 |
18 | const $ = cheerio.load(html.data);
19 |
20 |
21 | $('tbody tr').each((_, element) => {
22 | let seeders_leechers = $(element).find('td').eq(5).find('div').attr('title').trim().split('|');
23 | let seeders = seeders_leechers[0].replace('Seeders:', '').trim();
24 | let leechers = seeders_leechers[1].replace('Leechers:', '').trim();
25 |
26 | let torrent = {
27 | 'Name': $(element).find('td').eq(1).find('a').text().trim(),
28 | 'Size': $(element).find('td').eq(3).find('div div').text().trim(),
29 | 'DateUploaded': $(element).find('td').eq(4).text().trim(),
30 | 'Seeders': seeders,
31 | 'Leechers': leechers,
32 | 'Url': "https://zooqle.com" + $(element).find('td').eq(1).find('a').attr('href'),
33 | 'Magnet': $(element).find('td').eq(2).find('ul').find('li').eq(1).find('a').attr('href')
34 | }
35 | ALLTORRENT.push(torrent);
36 | })
37 | return ALLTORRENT;
38 | }
39 |
40 | module.exports = {
41 | zooqle: zooqle
42 | }
--------------------------------------------------------------------------------
/torrent/nyaaSI.js:
--------------------------------------------------------------------------------
1 | const cheerio = require('cheerio');
2 | const axios = require('axios');
3 |
4 |
5 | async function nyaaSI(query, page = '1') {
6 | let torrents = [];
7 | const url = 'https://nyaa.si/?f=0&c=0_0&q=' + query + '&p=' + page;
8 | let html = null;
9 | try {
10 | html = await axios.get(url);
11 | } catch {
12 | return null;
13 | }
14 | const regex = /.comments/gi;
15 | const nameRegex = /[a-zA-Z\W].+/g;
16 |
17 | const $ = cheerio.load(html.data);
18 |
19 | $('tbody tr').each((_, element) => {
20 |
21 | const data = {}
22 |
23 | const $find = $(element);
24 | $find.each((_, element) => {
25 | const td = $(element).children('td');
26 | data.Name = $(element).find('td[colspan="2"] a').text().trim().match(nameRegex)[0];
27 | data.Category = $(element).find('a').attr('title');
28 | data.Url = ('https://nyaa.si' + $(element).find('td[colspan="2"] a').attr('href')).replace(regex, '');
29 |
30 | $find.each((_, element) => {
31 | data.Size = $(td).eq(3).text();
32 | data.DateUploaded = $(td).eq(4).text();
33 | data.Seeders = $(td).eq(5).text();
34 | data.Leechers = $(td).eq(6).text();
35 | data.Downloads = $(td).eq(7).text();
36 | data.Torrent = 'https://nyaa.si' + $(element).find('.text-center a').attr('href');
37 | data.Magnet = $(element).find('.text-center a').next().attr('href')
38 | })
39 |
40 | });
41 | torrents.push(data);
42 |
43 | });
44 |
45 | return torrents
46 | }
47 |
48 | module.exports = {
49 | nyaaSI: nyaaSI
50 | }
--------------------------------------------------------------------------------
/torrent/limeTorrent.js:
--------------------------------------------------------------------------------
1 | const cheerio = require('cheerio')
2 | const axios = require('axios')
3 |
4 |
5 | async function limeTorrent(query, page = '1') {
6 | var ALLTORRENT = [];
7 | const url = `https://www.limetorrents.pro/search/all/${query}/seeds/${page}/`;
8 | let html;
9 | try {
10 | html = await axios.get(url, headers = {
11 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36"
12 | });
13 |
14 | } catch {
15 | return null;
16 | }
17 |
18 | const $ = cheerio.load(html.data);
19 |
20 | $('.table2 tbody tr').each((i, element) => {
21 | if (i > 0) {
22 | let category_and_age = $(element).find('td').eq(1).text().trim();
23 | category_and_age = category_and_age.split('-');
24 | let age = category_and_age[0].trim();
25 | let category = category_and_age[1].replace('in', '').trim();
26 | let torrent = {
27 | "Name": $(element).find('div.tt-name').text().trim(),
28 | "Size": $(element).find('td').eq(2).text().trim(),
29 | "Category": category,
30 | "Age": age,
31 | "Seeders": $(element).find('td').eq(3).text().trim(),
32 | "Leechers": $(element).find('td').eq(4).text().trim(),
33 | "Torrent": $(element).find('div.tt-name a').attr('href'),
34 | "Url": "https://www.limetorrents.pro" + $(element).find('div.tt-name a').next().attr('href')
35 | }
36 | ALLTORRENT.push(torrent);
37 | }
38 |
39 | })
40 | return ALLTORRENT;
41 |
42 | }
43 | module.exports = limeTorrent
--------------------------------------------------------------------------------
/torrent/torrentGalaxy.js:
--------------------------------------------------------------------------------
1 | const cheerio = require('cheerio');
2 | const axios = require('axios');
3 |
4 | async function torrentGalaxy(query = '', page = '0') {
5 |
6 | if(page !== '0'){
7 | try{
8 | page = Number(page) - 1;
9 | }catch{
10 | //
11 | }
12 | }
13 | const allTorrents = [];
14 | const url = "https://torrentgalaxy.to/torrents.php?search=" + query + "&sort=id&order=desc&page=" + page;
15 | let html;
16 | try{
17 | html = await axios.get(url);
18 | }catch{
19 | return null;
20 | }
21 |
22 | const $ = cheerio.load(html.data);
23 |
24 | $('div.tgxtablerow.txlight').each((i, element) => {
25 | const data = {};
26 | const posterRegex = /\bhttps?:[^)''"]+\.(?:jpg|jpeg|gif|png)(?![a-z])/g;
27 | data.Name = $(element).find(":nth-child(4) div a b").text();
28 | try {
29 | data.Poster = ($(element).attr('onmouseover')).match(posterRegex)[0];
30 | } catch {
31 | data.Poster = "";
32 | }
33 | data.Category = $(element).find(":nth-child(1) a small").text();
34 | data.Url = "https://torrentgalaxy.to" + $(element).find("a.txlight").attr('href');
35 | data.UploadedBy = $(element).find(':nth-child(7) span a span').text();
36 | data.Size = $(element).find(':nth-child(8)').text();
37 | data.Seeders = $(element).find(':nth-child(11) span font:nth-child(1)').text();
38 | data.Leechers = $(element).find(':nth-child(11) span font:nth-child(2)').text();
39 | data.DateUploaded = $(element).find(":nth-child(12)").text();
40 | data.Torrent = $(element).find(".tgxtablecell.collapsehide.rounded.txlight a").attr("href");
41 | data.Magnet = $(element).find(".tgxtablecell.collapsehide.rounded.txlight a").next().attr("href");
42 | allTorrents.push(data);
43 | })
44 | return allTorrents;
45 | }
46 | module.exports = torrentGalaxy
--------------------------------------------------------------------------------
/torrent/1337x.js:
--------------------------------------------------------------------------------
1 | const cheerio = require('cheerio');
2 | const axios = require('axios');
3 |
4 |
5 |
6 | async function torrent1337x(query = '', page = '1') {
7 |
8 | const allTorrent = [];
9 | let html;
10 | const url = 'https://1337xx.to/search/' + query + '/' + page + '/';
11 | try{
12 | html = await axios.get(url);
13 | }catch{
14 | return null;
15 | }
16 |
17 | const $ = cheerio.load(html.data)
18 |
19 | const links = $('td.name').map((_, element) => {
20 | var link = 'https://1337xx.to' + $(element).find('a').next().attr('href');
21 | return link;
22 |
23 | }).get();
24 |
25 |
26 | await Promise.all(links.map(async (element) => {
27 |
28 | const data = {};
29 | const labels = ['Category', 'Type', 'Language', 'Size', 'UploadedBy', 'Downloads', 'LastChecked', 'DateUploaded', 'Seeders', 'Leechers'];
30 | let html;
31 | try{
32 | html = await axios.get(element);
33 | }catch{
34 | return null;
35 | }
36 | const $ = cheerio.load(html.data);
37 | data.Name = $('.box-info-heading h1').text().trim();
38 | data.Magnet = $('.clearfix ul li a').attr('href') || "";
39 | const poster = $('div.torrent-image img').attr('src');
40 |
41 | if (typeof poster !== 'undefined') {
42 | if (poster.startsWith('http')){
43 | data.Poster = poster;
44 | }
45 | else{
46 | data.Poster = 'https:' + poster;
47 | }
48 | } else {
49 | data.Poster = ''
50 | }
51 |
52 | $('div .clearfix ul li > span').each((i, element) => {
53 | $list = $(element);
54 | data[labels[i]] = $list.text();
55 | })
56 | data.Url = element
57 |
58 | allTorrent.push(data)
59 | }))
60 |
61 | return allTorrent
62 | }
63 | module.exports = {
64 | torrent1337x: torrent1337x
65 | }
--------------------------------------------------------------------------------
/torrent/kickAss.js:
--------------------------------------------------------------------------------
1 | const cheerio = require('cheerio')
2 | const axios = require('axios')
3 |
4 |
5 | async function kickAss(query, page = '1') {
6 | var ALLTORRENT = [];
7 | let ALLURL = [];
8 | const url = "https://kickasstorrents.to/usearch/" + query + "/" + page + "/";
9 | let html;
10 | try {
11 | html = await axios.get(url, headers = {
12 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36"
13 | });
14 |
15 | } catch {
16 | return null;
17 | }
18 |
19 | const $ = cheerio.load(html.data);
20 |
21 | $('tbody tr').each((i, element) => {
22 | if (i > 2) {
23 | let url = "https://kickasstorrents.to" + $(element).find('a.cellMainLink').attr('href');
24 | if (!url.endsWith('undefined')) {
25 | ALLURL.push(url);
26 | let torrent = {
27 | "Name": $(element).find('a.cellMainLink').text().trim(),
28 | "Size": $(element).find('td').eq(1).text().trim(),
29 | "UploadedBy": $(element).find('td').eq(2).text().trim(),
30 | "Age": $(element).find('td').eq(3).text().trim(),
31 | "Seeders": $(element).find('td').eq(4).text().trim(),
32 | "Leechers": $(element).find('td').eq(5).text().trim(),
33 | "Url": url
34 | }
35 | ALLTORRENT.push(torrent);
36 | }
37 | }
38 |
39 | })
40 |
41 | await Promise.all(ALLURL.map(async (url) => {
42 | for (let i = 0; i < ALLTORRENT.length; i++) {
43 | if (ALLTORRENT[i]['Url'] === url) {
44 | let html;
45 | try {
46 | html = await axios.get(url, headers = {
47 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36"
48 | });
49 | } catch {
50 | return;
51 | }
52 | const $ = cheerio.load(html.data);
53 | ALLTORRENT[i].Magnet = $('a.kaGiantButton').attr('href');
54 |
55 | }
56 | }
57 | }))
58 | return ALLTORRENT;
59 | }
60 | module.exports = kickAss;
--------------------------------------------------------------------------------
/torrent/torLock.js:
--------------------------------------------------------------------------------
1 | const cheerio = require('cheerio');
2 | const axios = require('axios');
3 |
4 | async function torLock(query = '', page = '1') {
5 |
6 | const ALLTORRENT = [];
7 | const ALLURL =[]
8 | const url = encodeURI('https://www.torlock.com/all/torrents/' + query + '/' + page + '.html');
9 | let html;
10 | try {
11 | html = await axios.get(url);
12 | } catch (error) {
13 | return null;
14 | }
15 |
16 | const $ = cheerio.load(html.data)
17 |
18 | $('.table tbody tr').each((i, element) => {
19 |
20 | if (i > 3) {
21 | let url = "https://www.torlock.com" + $(element).find('td').eq(0).find('div a').attr('href');
22 | ALLURL.push(url);
23 | let torrent = {
24 | 'Name': $(element).find('td').eq(0).find('div a b').text().trim(),
25 | 'Size': $(element).find('td').eq(2).text().trim(),
26 | 'DateUploaded': $(element).find('td').eq(1).text().trim(),
27 | 'Seeders': $(element).find('td').eq(3).text().trim(),
28 | 'Leechers': $(element).find('td').eq(4).text().trim(),
29 | 'Url': url
30 | }
31 | if (torrent.Name !== '') {
32 | ALLTORRENT.push(torrent);
33 | }
34 | }
35 | })
36 |
37 | await Promise.all(ALLURL.map(async url => {
38 | for (let i = 0; i < ALLTORRENT.length; i++) {
39 | if (ALLTORRENT[i]['Url'] === url) {
40 | let html;
41 | try {
42 | html = await axios.get(url, headers = {
43 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36"
44 | });
45 | } catch {
46 | return;
47 | }
48 | const $ = cheerio.load(html.data);
49 | ALLTORRENT[i].Torrent = $("body > article > div:nth-child(6) > div > div:nth-child(2) > a").attr('href') || "";
50 | ALLTORRENT[i].Magnet = $('body > article > table:nth-child(5) > thead > tr > th > div:nth-child(2) > h4 > a:nth-child(1)').attr('href');
51 |
52 | }
53 | }
54 |
55 | }))
56 |
57 | return ALLTORRENT;
58 | }
59 |
60 |
61 | module.exports = {
62 | torLock: torLock
63 | }
--------------------------------------------------------------------------------
/torrent/torrentFunk.js:
--------------------------------------------------------------------------------
1 | const cheerio = require('cheerio')
2 | const axios = require('axios')
3 |
4 | async function torrentFunk(query, page = '1') {
5 | var ALLTORRENT = [];
6 | var ALLURL = [];
7 | const url = `https://www.torrentfunk.com/all/torrents/${query}.html`;
8 | let html;
9 | try {
10 | html = await axios.get(url, headers = {
11 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36"
12 | });
13 |
14 | } catch {
15 | return null;
16 | }
17 |
18 | const $ = cheerio.load(html.data);
19 |
20 | $('.tmain tbody tr').each((i, element) => {
21 |
22 | if (i > 4) {
23 | let url = "https://www.torrentfunk.com" + $(element).find('td').eq(0).find('a').attr('href');
24 | ALLURL.push(url);
25 | let torrent = {
26 | 'Name': $(element).find('td').eq(0).find('a').text().trim(),
27 | 'Size': $(element).find('td').eq(2).text(),
28 | 'DateUploaded': $(element).find('td').eq(1).text(),
29 | 'Uploader': $(element).find('td').eq(5).text(),
30 | 'Seeders': $(element).find('td').eq(3).text(),
31 | 'Leechers': $(element).find('td').eq(4).text(),
32 | 'Url': url
33 | }
34 | if (torrent.Name !== '') {
35 | ALLTORRENT.push(torrent);
36 | }
37 | }
38 | })
39 |
40 | await Promise.all(ALLURL.map(async url => {
41 | for (let i = 0; i < ALLTORRENT.length; i++) {
42 | if (ALLTORRENT[i]['Url'] === url) {
43 | let html;
44 | try {
45 | html = await axios.get(url, headers = {
46 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36"
47 | });
48 | } catch {
49 | return;
50 | }
51 | const $ = cheerio.load(html.data);
52 | ALLTORRENT[i].Torrent = "https://www.torrentfunk.com" + $('#right > main > div.content > table:nth-child(3) > tbody > tr > td:nth-child(2) > a').attr('href');
53 |
54 | }
55 | }
56 |
57 | }))
58 |
59 | return ALLTORRENT;
60 | }
61 | module.exports = torrentFunk;
--------------------------------------------------------------------------------
/torrent/torrentProject.js:
--------------------------------------------------------------------------------
1 | const cheerio = require('cheerio')
2 | const axios = require('axios')
3 |
4 | async function torrentProject(query, page = '0') {
5 | var ALLTORRENT = [];
6 | var ALLURL = [];
7 | const url = `https://torrentproject2.com/?t=${query}&p=${page}&orderby=seeders`;
8 | let html;
9 | try {
10 | html = await axios.get(url, headers = {
11 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36"
12 | });
13 |
14 | } catch {
15 | return null;
16 | }
17 |
18 | const $ = cheerio.load(html.data);
19 |
20 | $('.tt div').each((i, element) => {
21 |
22 | if (i > 1) {
23 | let url = "https://torrentproject2.com" + $(element).find('span').eq(0).find('a').attr('href');
24 | ALLURL.push(url);
25 | let torrent = {
26 | 'Name': $(element).find('span:nth-child(1)').text().trim(),
27 | 'Size': $(element).find('span:nth-child(5)').text(),
28 | 'DateUploaded': $(element).find('span:nth-child(4)').text().trim(),
29 | 'Seeders': $(element).find('span:nth-child(2)').text().trim(),
30 | 'Leechers': $(element).find('span:nth-child(3)').text().trim(),
31 | 'Url': url
32 | }
33 | if (torrent.Name !== '') {
34 | ALLTORRENT.push(torrent);
35 | }
36 | }
37 | })
38 |
39 | await Promise.all(ALLURL.map(async url => {
40 | for (let i = 0; i < ALLTORRENT.length; i++) {
41 | if (ALLTORRENT[i]['Url'] === url) {
42 | let html;
43 | try {
44 | html = await axios.get(url, headers = {
45 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36"
46 | });
47 | } catch {
48 | return;
49 | }
50 | const $ = cheerio.load(html.data);
51 | let magnet = $('.usite a').attr('href');
52 | let startMagnetIdx = magnet.indexOf('magnet');
53 | magnet = magnet.slice(startMagnetIdx);
54 | ALLTORRENT[i].Magnet = decodeURIComponent(magnet);
55 |
56 | }
57 | }
58 |
59 | }))
60 |
61 | return ALLTORRENT;
62 | }
63 |
64 |
65 | module.exports = torrentProject;
--------------------------------------------------------------------------------
/torrent/ettv.js:
--------------------------------------------------------------------------------
1 | const cheerio = require('cheerio');
2 | const axios = require('axios');
3 | const dev = require('request-promise');
4 |
5 | async function ettvCentral(query, page = '0') {
6 | const ALLURLARRAY = [];
7 | var ALLTORRENT = [];
8 | const url = "https://www.ettvcentral.com/torrents-search.php?search= " + query + "&page=" + page;
9 | let html;
10 | try {
11 | html = await dev({
12 | url: url,
13 | // proxy: 'Enter your proxy uri here'
14 | })
15 |
16 | } catch {
17 | return null;
18 | }
19 |
20 | const $ = cheerio.load(html);
21 | $('table tbody').each((_, element) => {
22 | $('tr').each((_, el) => {
23 | const data = {};
24 | const td = $(el).children('td');
25 | data.Name = $(td).eq(1).find('a b').text();
26 | data.Category = $(td).eq(0).find('a img').attr('title');
27 | data.DateUploaded = $(td).eq(2).text();
28 | data.Size = $(td).eq(3).text();
29 | data.Seeders = $(td).eq(5).text();
30 | data.Leechers = $(td).eq(6).text();
31 | data.UploadedBy = $(td).eq(7).text();
32 | data.Url = "https://www.ettvcentral.com" + $(td).eq(1).find('a').attr('href');
33 | if (data.Name !== "") {
34 | ALLURLARRAY.push(data.Url);
35 | ALLTORRENT.push(data);
36 | }
37 | })
38 | })
39 | await Promise.all(ALLURLARRAY.map(async (url) => {
40 | for (let i = 0; i < ALLTORRENT.length; i++) {
41 | if (ALLTORRENT[i]['Url'] === url) {
42 | let html;
43 | try {
44 | html = await dev({
45 | url: url,
46 | // proxy: 'Enter your proxy uri here',
47 | })
48 | } catch {
49 | return null;
50 | }
51 | let $ = cheerio.load(html);
52 | let poster = '';
53 | try {
54 | poster = $('div .torrent_data').find('center img').attr('src');
55 | } catch {
56 | //
57 | }
58 | ALLTORRENT[i].Poster = poster;
59 | ALLTORRENT[i].Magnet = $("#downloadbox > table > tbody > tr > td:nth-child(1) > a").attr('href');
60 |
61 | }
62 | }
63 | }))
64 |
65 | return ALLTORRENT;
66 | }
67 |
68 | module.exports = ettvCentral
--------------------------------------------------------------------------------
/torrent/rarbg.js:
--------------------------------------------------------------------------------
1 | const cheerio = require('cheerio')
2 | const axios = require('axios')
3 |
4 |
5 | async function rarbg(query, page = '1') {
6 | const ALLURLARRAY = [];
7 | var ALLTORRENT = [];
8 | const url = "https://rargb.to/search/" + page + "/?search=" + query;
9 | let html;
10 | try {
11 | html = await axios.get(url, headers = {
12 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36"
13 | });
14 |
15 | } catch {
16 | return null;
17 | }
18 |
19 | const $ = cheerio.load(html.data);
20 |
21 | $('table.lista2t tbody').each((_, element) => {
22 | $('tr.lista2').each((_, el) => {
23 | const data = {};
24 | const td = $(el).children('td');
25 | data.Name = $(td).eq(1).find('a').attr('title');
26 | data.Category = $(td).eq(2).find('a').text();
27 | data.DateUploaded = $(td).eq(3).text();
28 | data.Size = $(td).eq(4).text();
29 | data.Seeders = $(td).eq(5).find('font').text();
30 | data.Leechers = $(td).eq(6).text();
31 | data.UploadedBy = $(td).eq(7).text();
32 | data.Url = "https://rargb.to" + $(td).eq(1).find('a').attr('href');
33 | ALLURLARRAY.push(data.Url);
34 | ALLTORRENT.push(data);
35 |
36 | })
37 | });
38 |
39 | await Promise.all(ALLURLARRAY.map(async (url) => {
40 | for (let i = 0; i < ALLTORRENT.length; i++) {
41 | if (ALLTORRENT[i]['Url'] === url) {
42 | let html;
43 | try{
44 | html = await axios.get(url, headers = {
45 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36"
46 | });
47 | }catch{
48 | return null;
49 | }
50 |
51 | let $ = cheerio.load(html.data);
52 |
53 | let poster = "https://rargb.to" + $("tr:nth-child(4) > td:nth-child(2) > img:nth-child(1)").attr('src') || "";
54 | if (!poster.endsWith('undefined')) {
55 | ALLTORRENT[i].Poster = poster;
56 | } else {
57 | ALLTORRENT[i].Poster = "";
58 | }
59 | ALLTORRENT[i].Magnet = $("tr:nth-child(1) > td:nth-child(2) > a:nth-child(3)").attr('href');
60 | }
61 | }
62 |
63 | }))
64 | return ALLTORRENT;
65 | }
66 | module.exports = rarbg;
--------------------------------------------------------------------------------
/torrent/yts.js:
--------------------------------------------------------------------------------
1 | const cheerio = require('cheerio');
2 | const axios = require('axios');
3 |
4 |
5 |
6 | async function yts(query, page = '1') {
7 |
8 | let all = []
9 | let ALLURL = [];
10 | if (page === '' || page === '1') {
11 | var url = "https://yts.mx/browse-movies/" + query + "/all/all/0/latest/0/all"
12 | } else {
13 | var url = "https://yts.mx/browse-movies/" + query + "/all/all/0/latest/0/all?page=" + page;
14 | }
15 | let html;
16 | try {
17 | html = await axios.get(url, headers = {
18 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36"
19 | });
20 | } catch {
21 | return null;
22 | }
23 |
24 | const $ = cheerio.load(html.data);
25 | $('div.browse-movie-bottom').each((_, element) => {
26 | let url = $(element).find('a').attr('href');
27 | ALLURL.push(url);
28 | })
29 |
30 | await Promise.all(ALLURL.map(async (url) => {
31 | const data = {
32 | 'Name': null,
33 | 'ReleasedDate': null,
34 | 'Genre': null,
35 | 'Rating': null,
36 | 'Likes': null,
37 | 'Runtime': null,
38 | 'Language': null,
39 | 'Url': null,
40 | 'Poster': null,
41 | 'Files': []
42 | };
43 | let html;
44 | try {
45 | html = await axios.get(url);
46 | } catch {
47 | return;
48 | }
49 |
50 | const $ = cheerio.load(html.data);
51 |
52 | data['Name'] = $('div.hidden-xs').find('h1').text();
53 | data['ReleasedDate'] = $('div.hidden-xs').find('h2').eq(0).text();
54 | data['Genre'] = $('div.hidden-xs').find('h2').eq(1).text();
55 | data['Rating'] = (($('div.bottom-info div.rating-row').eq(3).find('span').eq(0).text()) + ' ⭐').trim() || 'Not Rated'
56 | data['Likes'] = $('div.bottom-info div.rating-row').eq(0).find('span').eq(1).text()
57 | data['Runtime'] = $('div .tech-spec-info').find('div .row').eq(1).find('div .tech-spec-element').eq(2).text().trim();
58 | data['Language'] = $('div .tech-spec-info').find('div .row').eq(0).find('div .tech-spec-element').eq(2).text().trim();
59 | data['Url'] = url;
60 | data['Poster'] = $('div #movie-poster').eq(0).find('img').attr('src');
61 |
62 | $('.modal-download > div:nth-child(1) div.modal-content').each((i, el) => {
63 | $('div.modal-torrent').each((_, ele) => {
64 | let files = {};
65 | files.Quality = $(ele).find(':nth-child(1) >span').text();;
66 | files.Type = $(ele).find(':nth-child(2)').text();
67 | files.Size = $(ele).find(':nth-child(5)').text();
68 | files.Torrent = $(ele).find(':nth-child(6)').attr('href');
69 | files.Magnet = $(ele).find(':nth-child(7)').attr('href');
70 |
71 | data.Files.push(files);
72 | })
73 |
74 |
75 | })
76 | all.push(data);
77 | }))
78 |
79 | return all;
80 |
81 |
82 |
83 | }
84 |
85 |
86 | module.exports = {
87 | yts: yts
88 | }
--------------------------------------------------------------------------------
/torrent/COMBO.js:
--------------------------------------------------------------------------------
1 | const scrap1337x = require('./1337x');
2 | const scrapNyaa = require('./nyaaSI');
3 | const scrapYts = require('./yts');
4 | const scrapPirateBay = require('./pirateBay');
5 | const scrapTorLock = require('./torLock');
6 | const scrapEzTVio = require('./ezTV');
7 | const torrentGalaxy = require('./torrentGalaxy');
8 | const rarbg = require('./rarbg');
9 | const zooqle = require('./zooqle');
10 | const kickAss = require('./kickAss');
11 | const bitSearch = require('./bitSearch');
12 | const glodls = require('./gloTorrents');
13 | const magnet_dl = require('./magnet_dl');
14 | const limeTorrent = require('./limeTorrent');
15 | const torrentFunk = require('./torrentFunk');
16 | const torrentProject = require('./torrentProject');
17 |
18 |
19 | async function combo(query, page) {
20 | let comboTorrent = []
21 | await Promise.all([
22 | torrentGalaxy(query, page),
23 | scrapNyaa.nyaaSI(query, page),
24 | scrapYts.yts(query, page),
25 | scrapPirateBay.pirateBay(query, page),
26 | scrapTorLock.torLock(query, page),
27 | scrapEzTVio.ezTV(query),
28 | scrap1337x.torrent1337x(query, page),
29 | rarbg(query, page),
30 | zooqle.zooqle(query, page),
31 | kickAss(query, page),
32 | bitSearch(query, page),
33 | glodls(query, page),
34 | magnet_dl(query, page),
35 | limeTorrent(query, page),
36 | torrentFunk(query, page),
37 | torrentProject(query, page)
38 |
39 | ])
40 | .then(([tgx, nyaasi, yts, piratebay, torlock, eztv, x1337, rarbg, zql, kick, bts, glo, mg_dl, lmt, tfk, tpj]) => {
41 |
42 | if (tgx !== null && tgx.length > 0) {
43 | comboTorrent.push(tgx);
44 | }
45 | if (nyaasi !== null && nyaasi.length > 0) {
46 | comboTorrent.push(nyaasi);
47 | }
48 | if (yts !== null && yts.length > 0) {
49 | comboTorrent.push(yts);
50 | }
51 | if (piratebay !== null && piratebay.length > 0) {
52 | comboTorrent.push(piratebay);
53 | }
54 | if (torlock !== null && torlock.length > 0) {
55 | comboTorrent.push(torlock);
56 | }
57 | if (eztv !== null && eztv.length > 0) {
58 | comboTorrent.push(eztv);
59 | }
60 | if (x1337 !== null && x1337.length > 0) {
61 | comboTorrent.push(x1337);
62 | }
63 | if (rarbg !== null && rarbg.length > 0) {
64 | comboTorrent.push(rarbg);
65 | }
66 | if (zql !== null && zql.length > 0) {
67 | comboTorrent.push(zql);
68 | }
69 | if (kick !== null && kick.length > 0) {
70 | comboTorrent.push(kick);
71 | }
72 | if (bts !== null && bts.length > 0) {
73 | comboTorrent.push(bts);
74 | }
75 | if (glo !== null && glo.length > 0) {
76 | comboTorrent.push(glo);
77 | }
78 | if (mg_dl !== null && mg_dl.length > 0) {
79 | comboTorrent.push(mg_dl);
80 | }
81 | if (lmt !== null && lmt.length > 0) {
82 | comboTorrent.push(lmt);
83 | }
84 | if (tfk !== null && tfk.length > 0) {
85 | comboTorrent.push(tfk);
86 | }
87 | if (tpj !== null && tpj.length > 0) {
88 | comboTorrent.push(tpj);
89 | }
90 | })
91 | return comboTorrent;
92 | }
93 | module.exports = combo;
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Torrent Searcher API with Website 🔥
2 |
3 |
4 |
5 | > Unofficial API for scraping torrents from 1337x, Piratebay, Eztv, Nyaasi, Torlock, YTS, Torrent Galaxy, Rarbg, Zooqle, KickAss, Bitsearch, Glodls, MagnetDL, LimeTorrent, TorrentFunk, TorrentProject and Ettv.
6 |
7 | ---
8 |
9 | ## ⚙️How to install?
10 |
11 | ```sh
12 |
13 | # Clone the repo
14 | $ git clone https://github.com/bipuldey19/Torrent-Searcher-API-with-Website.git
15 |
16 | # Install Depedencies
17 | $ npm install
18 |
19 | # Start the server
20 | $ npm start
21 |
22 | ```
23 |
24 | ---
25 |
26 | ## 🤔How it works?
27 |
28 | ```
29 | /api/{keyword}/{query}/{page(optional)}
30 |
31 | ```
32 |
33 | ---
34 |
35 | ## 🔏Keywords
36 |
37 | | Website | Keyword | Url | Example |
38 | | -------------- | ---------------------------------------------- | --------------------------------- | ----------------------------------------------------------------------------------------------- |
39 | | 1337x | 1337x | | [/api/1337x/avengers](https://torrents-api.ryukme.repl.co/api/1337x/avengers) |
40 | | Yts | yts | | [/api/yts/avengers](https://torrents-api.ryukme.repl.co/api/yts/avengers) |
41 | | Eztv | eztv | | [/api/eztv/avengers](https://torrents-api.ryukme.repl.co/api/eztv/avengers) |
42 | | Torrent Galaxy | tgx | | [/api/tgx/avengers](https://torrents-api.ryukme.repl.co/api/tgx/avengers) |
43 | | Torlock | torlock | | [/api/torlock/avengers](https://torrents-api.ryukme.repl.co/api/torlock/avengers) |
44 | | PirateBay | piratebay | | [/api/piratebay/avengers](https://torrents-api.ryukme.repl.co/api/piratebay/avengers) |
45 | | Nyaasi | nyaasi | | [/api/nyaasi/umaru](https://torrents-api.ryukme.repl.co/api/nyaasi/umaru) |
46 | | Rarbg | rarbg | | [/api/rarbg/avengers](https://torrents-api.ryukme.repl.co/api/rarbg/avengers) |
47 | | Ettv | ettv | | [/api/ettv/avengers](https://torrents-api.ryukme.repl.co/api/ettv/avengers) |
48 | | Zooqle | zooqle | | [/api/zooqle/avengers](https://torrents-api.ryukme.repl.co/api/zooqle/avengers) |
49 | | KickAss | kickass | | [/api/kickass/avengers](https://torrents-api.ryukme.repl.co/api/kickass/avengers) |
50 | | Bitsearch | bitsearch | | [/api/bitsearch/avengers](https://torrents-api.ryukme.repl.co/api/bitsearch/avengers) |
51 | | Glodls | glodls | | [/api/glodls/avengers](https://torrents-api.ryukme.repl.co/api/glodls/avengers) |
52 | | MagnetDL | magnetdl | | [/api/magnetdl/avengers](https://torrents-api.ryukme.repl.co/api/magnetdl/avengers) |
53 | | LimeTorrent | limetorrent | | [/api/limetorrent/avengers](https://torrents-api.ryukme.repl.co/api/limetorrent/avengers) |
54 | | TorrentFunk | torrentfunk | | [/api/torrentfunk/avengers](https://torrents-api.ryukme.repl.co/api/torrentfunk/avengers) |
55 | | TorrentProject | torrentproject | | [/api/torrentproject/avengers](https://torrents-api.ryukme.repl.co/api/torrentproject/avengers) |
56 | | all | all (It will retrieve torrent from every site) | | [/api/all/avengers](https://torrents-api.ryukme.repl.co/api/all/avengers) |
57 |
58 | ---
59 |
60 | ## 🗒️Example
61 |
62 | #### 📤Request
63 |
64 | ```
65 | /api/1337x/avengers
66 | ```
67 |
68 | #### 📥Response
69 |
70 | ```json
71 | [
72 | {
73 | "Name": "Avengers: Infinity War (2018) [BluRay] [720p] [YTS] [YIFY]",
74 | "Magnet": "magnet:?xt=urn:btih:EA17E6BE92962A403AC1C638D2537DCF1E564D26&dn=Avengers%3A+Infinity+War+%282018%29+%5BBluRay%5D+%5B720p%5D+%5BYTS%5D+%5BYIFY%5D&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969%2Fannounce&tr=udp%3A%2F%2F9.rarbg.com%3A2710%2Fannounce&tr=udp%3A%2F%2Fp4p.arenabg.com%3A1337&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969&tr=udp%3A%2F%2Ftracker.internetwarriors.net%3A1337&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.zer0day.to%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.leechers-paradise.org%3A6969%2Fannounce&tr=udp%3A%2F%2Fcoppersurfer.tk%3A6969%2Fannounce",
75 | "Poster": "https://lx1.dyncdn.cc/cdn/ab/ab366d3d14d0af54fa6da1543a618251.jpg",
76 | "Category": "Movies",
77 | "Type": "HD",
78 | "Language": "English",
79 | "Size": "1.2 GB",
80 | "UploadedBy": " YTSAGx",
81 | "Downloads": "125311",
82 | "LastChecked": "2 years ago",
83 | "DateUploaded": "2 years ago",
84 | "Seeders": "8828",
85 | "Leechers": "4502",
86 | "Url": "https://1337x.to/torrent/3148366/Avengers-Infinity-War-2018-BluRay-720p-YTS-YIFY/"
87 | }
88 | ]
89 | ```
90 |
91 | ---
92 |
93 | #### 📤Request
94 |
95 | ```
96 | /api/tgx/avengers/1
97 | ```
98 |
99 | #### 📥Response
100 |
101 | ```json
102 | [
103 | {
104 | "Poster": "https://img.picturegalaxy.org/data/cover/h/W/hWOmQgIu5E.jpg",
105 | "Category": "Movies : HD",
106 | "Name": "Avengers.Endgame.2019.Open.Matte.Upscaled.BDRip.2160p.Eng.TrueHD.DD5.1.gerald99",
107 | "Url": "https://torrentgalaxy.to/torrent/14346596/Avengers-Endgame-2019-Open-Matte-Upscaled-BDRip-2160p-Eng-TrueHD-DD5-1-gerald99",
108 | "Torrent": "https://watercache.nanobytes.org/get/925d6bbd7faf6a3525aa3adcd0d8b560a671f3e6/Avengers.Endgame.2019.Open.Matte.Upscaled.BDRip.2160p.Eng.TrueHD.DD5.1.gerald99",
109 | "Magnet": "magnet:?xt=urn:btih:925d6bbd7faf6a3525aa3adcd0d8b560a671f3e6&dn=Avengers.Endgame.2019.Open.Matte.Upscaled.BDRip.2160p.Eng.TrueHD.DD5.1.gerald99&tr=udp%3A%2F%2Ftracker.tiny-vps.com%3A6969%2Fannounce&tr=udp%3A%2F%2Ffasttracker.foreverpirates.co%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Fexplodie.org%3A6969%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.cyberia.is%3A6969%2Fannounce&tr=udp%3A%2F%2Fipv4.tracker.harry.lu%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.uw0.xyz%3A6969%2Fannounce&tr=udp%3A%2F%2Ftracker.dler.org%3A6969%2Fannounce&tr=udp%3A%2F%2F9.rarbg.to%3A2710%2Fannounce",
110 | "UploadedBy": "gerald99",
111 | "Size": "34.62 GB",
112 | "Seeders": "6",
113 | "Leechers": "7",
114 | "DateUploaded": "10/04/21 10:46"
115 | }
116 |
117 | ]
118 | ```
119 |
120 | ---
121 |
122 | #### 📤Request
123 |
124 | ```
125 | /api/nyaasi/jujutsu kaisen/2
126 | ```
127 |
128 | #### 📥Response
129 |
130 | ```json
131 | [
132 | {
133 | "Category": "Anime - English-translated",
134 | "Name": "[ok] JUJUTSU KAISEN - 01 [Multi-Subs] [1080p].mkv",
135 | "Url": "https://nyaa.si/view/1285645",
136 | "Torrent": "https://nyaa.si/download/1285645.torrent",
137 | "Size": "1.4 GiB",
138 | "DateUploaded": "2020-10-02 17:48",
139 | "Seeders": "25",
140 | "Leechers": "0",
141 | "Downloads": "710",
142 | "Magnet": "magnet:?xt=urn:btih:986f957243b697d238108d1fa0ba1d0de6d602aa&dn=%5Bok%5D%20JUJUTSU%20KAISEN%20-%2001%20%5BMulti-Subs%5D%20%5B1080p%5D.mkv&tr=http%3A%2F%2Fnyaa.tracker.wf%3A7777%2Fannounce&tr=udp%3A%2F%2Fopen.stealth.si%3A80%2Fannounce&tr=udp%3A%2F%2Ftracker.opentrackr.org%3A1337%2Fannounce&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969%2Fannounce&tr=udp%3A%2F%2Fexodus.desync.com%3A6969%2Fannounce"
143 | }
144 | ]
145 | ```
146 |
147 | ---
148 |
149 | ## 🔍Want to try this API ?
150 |
151 | ```
152 | https://torrents-api.ryukme.repl.co/api/{keyword}/{query}/{page(optional)}
153 | ```
154 |
155 | 🔰Example
156 | ```
157 | https://torrents-api.ryukme.repl.co/api/nyaasi/jujutsu kaisen/2
158 | ```
159 |
160 | ---
161 |
162 | ## 🌐Want to try Website + API ?
163 |
164 | #### Coming soon ...
165 |
166 | ---
167 |
168 | ## 🛠️Deployment
169 |
170 | ### Deploy on VPS
171 |
172 | You can fork the repo and deploy on VPS
173 |
174 | ### Deploy on Heroku
175 |
176 | [](https://heroku.com/deploy?template=https://github.com/bipuldey19/Torrent-Searcher-API-with-Website)
177 |
178 | ### Deploy on Vercel
179 |
180 | [](https://vercel.com/new/clone?repository-url=https%3A%2F%2Fgithub.com%2Fbipuldey19%2FTorrents-Search-API-with-Website%2Ftree%2Fvercel)
181 |
182 | ### Deploy on Replit
183 |
184 | [](https://github.com/bipuldey19/Torrents-Search-API-with-Website/Replit.md)
185 |
186 | ### Deploy on Netlify (API + Torrent Searcher Website)
187 |
188 | [](https://github.com/bipuldey19/Torrent-Searcher-API-with-Website/tree/netlify)
189 |
190 | ---
191 |
192 | ## ©️ Credit
193 |
194 | | Contributor | Added Features |
195 | | ----------- | ----------- |
196 | | [RukeMe](https://github.com/Ryuk-me) | Built [Torrents-Api](https://github.com/Ryuk-me/Torrents-Api) + Made deployable with Heroku |
197 | | [Bipuldey](https://github.com/bipuldey19) | Made Torrent Searcher website with API + Made deployable with Netlify |
198 | | [Juned KH](https://github.com/junedkh) | Made deployable with Vercel + Contribution in website development |
199 | | [Ovin](https://github.com/vincreator) | Made deployable with Replit |
200 |
--------------------------------------------------------------------------------
/app.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const scrap1337x = require('./torrent/1337x');
3 | const scrapNyaa = require('./torrent/nyaaSI');
4 | const scrapYts = require('./torrent/yts');
5 | const scrapPirateBay = require('./torrent/pirateBay');
6 | const scrapTorLock = require('./torrent/torLock');
7 | const scrapEzTVio = require('./torrent/ezTV');
8 | const torrentGalaxy = require('./torrent/torrentGalaxy');
9 | const combo = require('./torrent/COMBO');
10 | const rarbg = require('./torrent/rarbg');
11 | const ettvCentral = require('./torrent/ettv');
12 | const zooqle = require('./torrent/zooqle');
13 | const kickAss = require('./torrent/kickAss');
14 | const bitSearch = require('./torrent/bitSearch');
15 | const glodls = require('./torrent/gloTorrents');
16 | const magnet_dl = require('./torrent/magnet_dl');
17 | const limeTorrent = require('./torrent/limeTorrent');
18 | const torrentFunk = require('./torrent/torrentFunk');
19 | const torrentProject = require('./torrent/torrentProject');
20 |
21 |
22 | const app = express();
23 |
24 | app.use('/api/:website/:query/:page?', (req, res, next) => {
25 | res.header("Access-Control-Allow-Origin", "*");
26 | res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
27 | let website = (req.params.website).toLowerCase();
28 | let query = req.params.query;
29 | let page = req.params.page;
30 |
31 | if (website === '1337x') {
32 | if (page > 50) {
33 | return res.json({
34 | error: 'Please enter page value less than 51 to get the result :)'
35 | })
36 | } else {
37 | scrap1337x.torrent1337x(query, page)
38 | .then((data) => {
39 | if (data === null) {
40 | return res.json({
41 | error: 'Website is blocked change IP'
42 | })
43 |
44 | } else if (data.length === 0) {
45 | return res.json({
46 | error: 'No search result available for query (' + query + ')'
47 | })
48 | } else {
49 | return res.send(data);
50 | }
51 |
52 | })
53 | }
54 | }
55 | if (website === 'yts') {
56 | scrapYts.yts(query, page)
57 | .then((data) => {
58 | if (data === null) {
59 | return res.json({
60 | error: 'Website is blocked change IP'
61 | })
62 |
63 | } else if (data.length === 0) {
64 | return res.json({
65 | error: 'No search result available for query (' + query + ')'
66 | })
67 | } else {
68 | return res.send(data);
69 | }
70 |
71 | })
72 | }
73 | if (website === 'eztv') {
74 | scrapEzTVio.ezTV(query)
75 | .then((data) => {
76 | if (data === null) {
77 | return res.json({
78 | error: 'Website is blocked change IP'
79 | })
80 |
81 | } else if (data.length === 0) {
82 | return res.json({
83 | error: 'No search result available for query (' + query + ')'
84 | })
85 | } else {
86 | return res.send(data);
87 | }
88 |
89 | })
90 | }
91 | if (website === 'torlock') {
92 | scrapTorLock.torLock(query, page)
93 | .then((data) => {
94 | if (data === null) {
95 | return res.json({
96 | error: 'Website is blocked change IP'
97 | })
98 |
99 | } else if (data.length === 0) {
100 | return res.json({
101 | error: 'No search result available for query (' + query + ')'
102 | })
103 | } else {
104 | return res.send(data);
105 | }
106 |
107 | })
108 | }
109 | if (website === 'piratebay') {
110 | scrapPirateBay.pirateBay(query, page)
111 | .then((data) => {
112 | if (data === null) {
113 | return res.json({
114 | error: 'Website is blocked change IP'
115 | })
116 |
117 | } else if (data.length === 0) {
118 | return res.json({
119 | error: 'No search result available for query (' + query + ')'
120 | })
121 | } else {
122 | return res.send(data);
123 | }
124 |
125 | })
126 | }
127 | if (website === 'tgx') {
128 | torrentGalaxy(query, page)
129 | .then((data) => {
130 | if (data === null) {
131 | return res.json({
132 | error: 'Website is blocked change IP'
133 | })
134 |
135 | } else if (data.length === 0) {
136 | return res.json({
137 | error: 'No search result available for query (' + query + ')'
138 | })
139 | } else {
140 | return res.send(data);
141 | }
142 |
143 | })
144 | }
145 |
146 | if (website === 'rarbg') {
147 | rarbg(query, page)
148 | .then((data) => {
149 | if (data === null) {
150 | return res.json({
151 | error: 'Website is blocked change IP'
152 | })
153 |
154 | } else if (data.length === 0) {
155 | return res.json({
156 | error: 'No search result available for query (' + query + ')'
157 | })
158 | } else {
159 | return res.send(data);
160 | }
161 |
162 | })
163 | }
164 |
165 |
166 | if (website === 'zooqle') {
167 | zooqle.zooqle(query, page)
168 | .then((data) => {
169 | if (data === null) {
170 | return res.json({
171 | error: 'Website is blocked change IP'
172 | })
173 |
174 | } else if (data.length === 0) {
175 | return res.json({
176 | error: 'No search result available for query (' + query + ')'
177 | })
178 | } else {
179 | return res.send(data);
180 | }
181 | })
182 | }
183 |
184 | if (website === 'kickass') {
185 | kickAss(query, page)
186 | .then((data) => {
187 | if (data === null) {
188 | return res.json({
189 | error: 'Website is blocked change IP'
190 | })
191 |
192 | } else if (data.length === 0) {
193 | return res.json({
194 | error: 'No search result available for query (' + query + ')'
195 | })
196 | } else {
197 | return res.send(data);
198 | }
199 | })
200 | }
201 |
202 |
203 | if (website === 'bitsearch') {
204 | bitSearch(query, page)
205 | .then((data) => {
206 | if (data === null) {
207 | return res.json({
208 | error: 'Website is blocked change IP'
209 | })
210 |
211 | } else if (data.length === 0) {
212 | return res.json({
213 | error: 'No search result available for query (' + query + ')'
214 | })
215 | } else {
216 | return res.send(data);
217 | }
218 | })
219 | }
220 | if (website === 'glodls') {
221 | glodls(query, page)
222 | .then((data) => {
223 | if (data === null) {
224 | return res.json({
225 | error: 'Website is blocked change IP'
226 | })
227 |
228 | } else if (data.length === 0) {
229 | return res.json({
230 | error: 'No search result available for query (' + query + ')'
231 | })
232 | } else {
233 | return res.send(data);
234 | }
235 | })
236 | }
237 | if (website === 'magnetdl') {
238 | magnet_dl(query, page)
239 | .then((data) => {
240 | if (data === null) {
241 | return res.json({
242 | error: 'Website is blocked change IP'
243 | })
244 |
245 | } else if (data.length === 0) {
246 | return res.json({
247 | error: 'No search result available for query (' + query + ')'
248 | })
249 | } else {
250 | return res.send(data);
251 | }
252 | })
253 | }
254 | if (website === 'limetorrent') {
255 | limeTorrent(query, page)
256 | .then((data) => {
257 | if (data === null) {
258 | return res.json({
259 | error: 'Website is blocked change IP'
260 | })
261 |
262 | } else if (data.length === 0) {
263 | return res.json({
264 | error: 'No search result available for query (' + query + ')'
265 | })
266 | } else {
267 | return res.send(data);
268 | }
269 | })
270 | }
271 | if (website === 'torrentfunk') {
272 | torrentFunk(query, page)
273 | .then((data) => {
274 | if (data === null) {
275 | return res.json({
276 | error: 'Website is blocked change IP'
277 | })
278 |
279 | } else if (data.length === 0) {
280 | return res.json({
281 | error: 'No search result available for query (' + query + ')'
282 | })
283 | } else {
284 | return res.send(data);
285 | }
286 | })
287 | }
288 | if (website === 'torrentproject') {
289 | torrentProject(query, page)
290 | .then((data) => {
291 | if (data === null) {
292 | return res.json({
293 | error: 'Website is blocked change IP'
294 | })
295 |
296 | } else if (data.length === 0) {
297 | return res.json({
298 | error: 'No search result available for query (' + query + ')'
299 | })
300 | } else {
301 | return res.send(data);
302 | }
303 | })
304 | }
305 |
306 | if (website === 'nyaasi') {
307 | if (page > 14) {
308 | return res.json({
309 | error: '14 is the last page'
310 | })
311 | } else {
312 | scrapNyaa.nyaaSI(query, page)
313 | .then((data) => {
314 | if (data === null) {
315 | return res.json({
316 | error: 'Website is blocked change IP'
317 | })
318 |
319 | } else if (data.length === 0) {
320 | return res.json({
321 | error: 'No search result available for query (' + query + ')'
322 | })
323 | } else {
324 | return res.send(data);
325 | }
326 |
327 | })
328 | }
329 |
330 | }
331 | if (website === "ettv") {
332 | ettvCentral(query, page)
333 | .then((data) => {
334 | if (data === null) {
335 | return res.json({
336 | error: 'Website is blocked change IP'
337 | })
338 |
339 | } else if (data.length === 0) {
340 | return res.json({
341 | error: 'No search result available for query (' + query + ')'
342 | })
343 | } else {
344 | return res.send(data);
345 | }
346 |
347 | })
348 |
349 | }
350 | if (website === "all") {
351 | combo(query, page).then((data) => {
352 | if (data !== null && data.length > 0) {
353 | return res.send(data);
354 | } else {
355 | return res.json({
356 | error: 'No search result available for query (' + query + ')'
357 | });
358 | }
359 | })
360 |
361 | } else if (website !== 'nyaasi' && website !== '1337x' && website !== 'yts' && website !== 'piratebay' && website !== 'torlock' && website !== 'eztv' && website !== 'tgx' && website !== 'all' && website !== "rarbg" && website !== 'ettv' && website !== 'zooqle' && website !== 'kickass' && website !== 'bitsearch' && website !== 'glodls' && website !== 'magnetdl' && website !== 'limetorrent' && website !== 'torrentfunk' && website !== 'torrentproject') {
362 | return res.json({
363 | error: 'please select 1337x | nyaasi | yts | Piratebay | torlock | eztv | TorrentGalaxy(tgx) | rarbg | zooqle | kickass | bitsearch | glodls | magnetdl | limetorrent | torrentfunk | torrentproject | all (to scrap from every site)'
364 | })
365 | }
366 |
367 | });
368 |
369 | app.use('/', (req, res) => {
370 | res.send('Welcome to 1337x, NyaaSi, YTS, PirateBay, Torlock, EzTvio, TorrentGalaxy, Rarbg, Zooqle, KickAss, Bitsearch, Glodls, MagnetDL, Limetorrent, TorrentFunk, TorrentProject and Ettv Central Unoffical API
');
371 | });
372 | const PORT = process.env.PORT || 3001;
373 | console.log('Listening on PORT : ', PORT);
374 | app.listen(PORT);
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const scrap1337x = require('./torrent/1337x');
3 | const scrapNyaa = require('./torrent/nyaaSI');
4 | const scrapYts = require('./torrent/yts');
5 | const scrapPirateBay = require('./torrent/pirateBay');
6 | const scrapTorLock = require('./torrent/torLock');
7 | const scrapEzTVio = require('./torrent/ezTV');
8 | const torrentGalaxy = require('./torrent/torrentGalaxy');
9 | const combo = require('./torrent/COMBO');
10 | const rarbg = require('./torrent/rarbg');
11 | const ettvCentral = require('./torrent/ettv');
12 | const zooqle = require('./torrent/zooqle');
13 | const kickAss = require('./torrent/kickAss');
14 | const bitSearch = require('./torrent/bitSearch');
15 | const glodls = require('./torrent/gloTorrents');
16 | const magnet_dl = require('./torrent/magnet_dl');
17 | const limeTorrent = require('./torrent/limeTorrent');
18 | const torrentFunk = require('./torrent/torrentFunk');
19 | const torrentProject = require('./torrent/torrentProject');
20 |
21 |
22 | const app = express();
23 |
24 | app.use('/api/:website/:query/:page?', (req, res, next) => {
25 | res.header("Access-Control-Allow-Origin", "*");
26 | res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
27 | let website = (req.params.website).toLowerCase();
28 | let query = req.params.query;
29 | let page = req.params.page;
30 |
31 | if (website === '1337x') {
32 | if (page > 50) {
33 | return res.json({
34 | error: 'Please enter page value less than 51 to get the result :)'
35 | })
36 | } else {
37 | scrap1337x.torrent1337x(query, page)
38 | .then((data) => {
39 | if (data === null) {
40 | return res.json({
41 | error: 'Website is blocked change IP'
42 | })
43 |
44 | } else if (data.length === 0) {
45 | return res.json({
46 | error: 'No search result available for query (' + query + ')'
47 | })
48 | } else {
49 | return res.send(data);
50 | }
51 |
52 | })
53 | }
54 | }
55 | if (website === 'yts') {
56 | scrapYts.yts(query, page)
57 | .then((data) => {
58 | if (data === null) {
59 | return res.json({
60 | error: 'Website is blocked change IP'
61 | })
62 |
63 | } else if (data.length === 0) {
64 | return res.json({
65 | error: 'No search result available for query (' + query + ')'
66 | })
67 | } else {
68 | return res.send(data);
69 | }
70 |
71 | })
72 | }
73 | if (website === 'eztv') {
74 | scrapEzTVio.ezTV(query)
75 | .then((data) => {
76 | if (data === null) {
77 | return res.json({
78 | error: 'Website is blocked change IP'
79 | })
80 |
81 | } else if (data.length === 0) {
82 | return res.json({
83 | error: 'No search result available for query (' + query + ')'
84 | })
85 | } else {
86 | return res.send(data);
87 | }
88 |
89 | })
90 | }
91 | if (website === 'torlock') {
92 | scrapTorLock.torLock(query, page)
93 | .then((data) => {
94 | if (data === null) {
95 | return res.json({
96 | error: 'Website is blocked change IP'
97 | })
98 |
99 | } else if (data.length === 0) {
100 | return res.json({
101 | error: 'No search result available for query (' + query + ')'
102 | })
103 | } else {
104 | return res.send(data);
105 | }
106 |
107 | })
108 | }
109 | if (website === 'piratebay') {
110 | scrapPirateBay.pirateBay(query, page)
111 | .then((data) => {
112 | if (data === null) {
113 | return res.json({
114 | error: 'Website is blocked change IP'
115 | })
116 |
117 | } else if (data.length === 0) {
118 | return res.json({
119 | error: 'No search result available for query (' + query + ')'
120 | })
121 | } else {
122 | return res.send(data);
123 | }
124 |
125 | })
126 | }
127 | if (website === 'tgx') {
128 | torrentGalaxy(query, page)
129 | .then((data) => {
130 | if (data === null) {
131 | return res.json({
132 | error: 'Website is blocked change IP'
133 | })
134 |
135 | } else if (data.length === 0) {
136 | return res.json({
137 | error: 'No search result available for query (' + query + ')'
138 | })
139 | } else {
140 | return res.send(data);
141 | }
142 |
143 | })
144 | }
145 |
146 | if (website === 'rarbg') {
147 | rarbg(query, page)
148 | .then((data) => {
149 | if (data === null) {
150 | return res.json({
151 | error: 'Website is blocked change IP'
152 | })
153 |
154 | } else if (data.length === 0) {
155 | return res.json({
156 | error: 'No search result available for query (' + query + ')'
157 | })
158 | } else {
159 | return res.send(data);
160 | }
161 |
162 | })
163 | }
164 |
165 |
166 | if (website === 'zooqle') {
167 | zooqle.zooqle(query, page)
168 | .then((data) => {
169 | if (data === null) {
170 | return res.json({
171 | error: 'Website is blocked change IP'
172 | })
173 |
174 | } else if (data.length === 0) {
175 | return res.json({
176 | error: 'No search result available for query (' + query + ')'
177 | })
178 | } else {
179 | return res.send(data);
180 | }
181 | })
182 | }
183 |
184 | if (website === 'kickass') {
185 | kickAss(query, page)
186 | .then((data) => {
187 | if (data === null) {
188 | return res.json({
189 | error: 'Website is blocked change IP'
190 | })
191 |
192 | } else if (data.length === 0) {
193 | return res.json({
194 | error: 'No search result available for query (' + query + ')'
195 | })
196 | } else {
197 | return res.send(data);
198 | }
199 | })
200 | }
201 |
202 |
203 | if (website === 'bitsearch') {
204 | bitSearch(query, page)
205 | .then((data) => {
206 | if (data === null) {
207 | return res.json({
208 | error: 'Website is blocked change IP'
209 | })
210 |
211 | } else if (data.length === 0) {
212 | return res.json({
213 | error: 'No search result available for query (' + query + ')'
214 | })
215 | } else {
216 | return res.send(data);
217 | }
218 | })
219 | }
220 | if (website === 'glodls') {
221 | glodls(query, page)
222 | .then((data) => {
223 | if (data === null) {
224 | return res.json({
225 | error: 'Website is blocked change IP'
226 | })
227 |
228 | } else if (data.length === 0) {
229 | return res.json({
230 | error: 'No search result available for query (' + query + ')'
231 | })
232 | } else {
233 | return res.send(data);
234 | }
235 | })
236 | }
237 | if (website === 'magnetdl') {
238 | magnet_dl(query, page)
239 | .then((data) => {
240 | if (data === null) {
241 | return res.json({
242 | error: 'Website is blocked change IP'
243 | })
244 |
245 | } else if (data.length === 0) {
246 | return res.json({
247 | error: 'No search result available for query (' + query + ')'
248 | })
249 | } else {
250 | return res.send(data);
251 | }
252 | })
253 | }
254 | if (website === 'limetorrent') {
255 | limeTorrent(query, page)
256 | .then((data) => {
257 | if (data === null) {
258 | return res.json({
259 | error: 'Website is blocked change IP'
260 | })
261 |
262 | } else if (data.length === 0) {
263 | return res.json({
264 | error: 'No search result available for query (' + query + ')'
265 | })
266 | } else {
267 | return res.send(data);
268 | }
269 | })
270 | }
271 | if (website === 'torrentfunk') {
272 | torrentFunk(query, page)
273 | .then((data) => {
274 | if (data === null) {
275 | return res.json({
276 | error: 'Website is blocked change IP'
277 | })
278 |
279 | } else if (data.length === 0) {
280 | return res.json({
281 | error: 'No search result available for query (' + query + ')'
282 | })
283 | } else {
284 | return res.send(data);
285 | }
286 | })
287 | }
288 | if (website === 'torrentproject') {
289 | torrentProject(query, page)
290 | .then((data) => {
291 | if (data === null) {
292 | return res.json({
293 | error: 'Website is blocked change IP'
294 | })
295 |
296 | } else if (data.length === 0) {
297 | return res.json({
298 | error: 'No search result available for query (' + query + ')'
299 | })
300 | } else {
301 | return res.send(data);
302 | }
303 | })
304 | }
305 |
306 | if (website === 'nyaasi') {
307 | if (page > 14) {
308 | return res.json({
309 | error: '14 is the last page'
310 | })
311 | } else {
312 | scrapNyaa.nyaaSI(query, page)
313 | .then((data) => {
314 | if (data === null) {
315 | return res.json({
316 | error: 'Website is blocked change IP'
317 | })
318 |
319 | } else if (data.length === 0) {
320 | return res.json({
321 | error: 'No search result available for query (' + query + ')'
322 | })
323 | } else {
324 | return res.send(data);
325 | }
326 |
327 | })
328 | }
329 |
330 | }
331 | if (website === "ettv") {
332 | ettvCentral(query, page)
333 | .then((data) => {
334 | if (data === null) {
335 | return res.json({
336 | error: 'Website is blocked change IP'
337 | })
338 |
339 | } else if (data.length === 0) {
340 | return res.json({
341 | error: 'No search result available for query (' + query + ')'
342 | })
343 | } else {
344 | return res.send(data);
345 | }
346 |
347 | })
348 |
349 | }
350 | if (website === "all") {
351 | combo(query, page).then((data) => {
352 | if (data !== null && data.length > 0) {
353 | return res.send(data);
354 | } else {
355 | return res.json({
356 | error: 'No search result available for query (' + query + ')'
357 | });
358 | }
359 | })
360 |
361 | } else if (website !== 'nyaasi' && website !== '1337x' && website !== 'yts' && website !== 'piratebay' && website !== 'torlock' && website !== 'eztv' && website !== 'tgx' && website !== 'all' && website !== "rarbg" && website !== 'ettv' && website !== 'zooqle' && website !== 'kickass' && website !== 'bitsearch' && website !== 'glodls' && website !== 'magnetdl' && website !== 'limetorrent' && website !== 'torrentfunk' && website !== 'torrentproject') {
362 | return res.json({
363 | error: 'please select 1337x | nyaasi | yts | Piratebay | torlock | eztv | TorrentGalaxy(tgx) | rarbg | zooqle | kickass | bitsearch | glodls | magnetdl | limetorrent | torrentfunk | torrentproject | all (to scrap from every site)'
364 | })
365 | }
366 |
367 | });
368 |
369 | app.use('/', (req, res) => {
370 | res.send('Welcome to 1337x, NyaaSi, YTS, PirateBay, Torlock, EzTvio, TorrentGalaxy, Rarbg, Zooqle, KickAss, Bitsearch, Glodls, MagnetDL, Limetorrent, TorrentFunk, TorrentProject and Ettv Central Unoffical API
');
371 | });
372 | const PORT = process.env.PORT || 3001;
373 | console.log('Listening on PORT : ', PORT);
374 | app.listen(PORT);
--------------------------------------------------------------------------------