thehiddenbay
Advanced tools
Comparing version 1.0.2 to 1.0.3
34
index.js
const cheerio = require('cheerio'); | ||
const axios = require('axios'); | ||
async function piratebay({query, category, page = '1'}) { | ||
if (category === 'Movies') { | ||
category = '99/0'; | ||
} else if (category === 'Series') { | ||
category = '205'; | ||
} else { | ||
category = ''; | ||
} | ||
async function piratebay({query}) { | ||
const torrents = []; | ||
const url = 'https://thehiddenbay.com/search/' + query + '/' + page + '/' + category; | ||
const url = 'https://thehiddenbay.com/search/' + query + '/1/99/200'; | ||
let html; | ||
@@ -22,27 +13,22 @@ try{ | ||
} | ||
const $ = cheerio.load(html.data); | ||
$("table#searchResult tr").each((_, element) => { | ||
$('table#searchResult tr').each((_, element) => { | ||
const data = $(element).find('font.detDesc').text().replace(/(Size|Uploaded)/gi, '').replace(/ULed/gi, 'Uploaded').split(',').map(value => value.trim()); | ||
const date = data[0] | ||
const size = data[1] | ||
const uploader = $(element).find('font.detDesc a').text() | ||
const date = data[0]; | ||
const size = data[1]; | ||
const torrent = { | ||
title: $(element).find('a.detLink').text(), | ||
magnet: $(element).find("td div.detName").next().attr('href'), | ||
url: $(element).find('a.detLink').attr('href'), | ||
magnet: $(element).find('td div.detName').next().attr('href'), | ||
seed: $(element).find('td').eq(2).text(), | ||
leech: $(element).find('td').eq(3).text(), | ||
size: size, | ||
uploader: uploader, | ||
size: size ? size.replace('i', '') : size | ||
} | ||
if (torrent.title.length) { | ||
torrents.push(torrent) | ||
torrents.push(torrent); | ||
} | ||
}); | ||
}); | ||
return {domain: url, query: query, torrents}; | ||
} | ||
} | ||
module.exports.search = piratebay; |
{ | ||
"name": "thehiddenbay", | ||
"description": "thepiratebay unoffical api", | ||
"author": { | ||
"name": "Persei08", | ||
"email": "persei8@protonmail.ch" | ||
}, | ||
"version": "1.0.3", | ||
"bugs": { | ||
"url": "https://github.com/Persei08/thepiratebay/issues" | ||
}, | ||
"dependencies": { | ||
@@ -9,2 +16,3 @@ "axios": "^0.21", | ||
}, | ||
"description": "thepiratebay unoffical api", | ||
"devDependencies": { | ||
@@ -19,9 +27,2 @@ "expect.js": "^0.3.1", | ||
"homepage": "https://github.com/Persei08/thepiratebay#readme", | ||
"author": { | ||
"name": "Persei08", | ||
"email": "persei8@protonmail.ch" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/Persei08/thepiratebay/issues" | ||
}, | ||
"keywords": [ | ||
@@ -42,4 +43,3 @@ "tv", | ||
"test": "mocha test.js --reporter spec --timeout 15000 --require mocha-clean" | ||
}, | ||
"version": "1.0.2" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2130
31