Skip to content

Commit

Permalink
Add Zooqle
Browse files Browse the repository at this point in the history
  • Loading branch information
ItzBlitz98 committed Sep 10, 2017
1 parent 0902d18 commit 0b7ae6e
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@
"torrentproject": {
name: 'TorrentProject',
url: "https://www.torrentproject.se"
},
"zooqle": {
name: 'Zooqle',
url: "https://zooqle.com"
}
},
"options": {
Expand Down
2 changes: 2 additions & 0 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
var limetorrents = require('./limetorrents.js');
var tpb = require('./thepiratebay.js');
var sky = require('./skytorrents.js');
var zooqle = require('./zooqle.js');
var yts = require('./yts.js');
var leetx = require('./1337x.js');
var nyaa = require('./nyaa.js');
Expand Down Expand Up @@ -55,6 +56,7 @@
'tpb': tpb,
'sky': sky,
'yts': yts,
'zooqle': zooqle,
'leetx': leetx,
'nyaa': nyaa,
'tokyotosho': tokyotosho,
Expand Down
2 changes: 1 addition & 1 deletion lib/skytorrents.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ module.exports = {
date_added = find_torrent_date.first().text();

links = $(torrents).find('td a');
console.log(links);

$(links).each(function(i, link){

if($(link).attr('href').indexOf("magnet:?xt=urn:") > -1) {
Expand Down
84 changes: 84 additions & 0 deletions lib/zooqle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
var Q = require('q');
var request = require("request");
var cheerio = require('cheerio');

module.exports = {
search: function(query, zooqle_url, cat, page, limit) {
var count = 1;
var deferred = Q.defer();
var data_content = {};
var torrent_content = [];
var torrent_verified;
var search_url = zooqle_url + '/search?q=' + encodeURIComponent(query) + '&sd=d';

var options = {
url: search_url,
headers: {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.79 Safari/537.36'
}
};


request(options, function(err, response, body){

if(!err && response.statusCode === 200){

$ = cheerio.load(body);

// console.log(body);
if($('table.table-torrents tr').length > 2){
$('table.table-torrents tr').each(function(index, torrents){
var torrent_link;

find_torrent_title = $(torrents).find('a.small');
find_torrent_size = $(torrents).find('div.prog-blue');
find_torrent_seeders = $(torrents).find('div.prog-green');
find_torrent_leechers = $(torrents).find('div.prog-yellow');
find_date_added = $(torrents).find('td.text-nowrap.text-muted.smaller');

links = $(torrents).find('a');
$(links).each(function(i, link){

if($(link).attr('href').indexOf("magnet:?xt=urn:") > -1 && $(link).attr('href') !== null) {
torrent_link = $(link).attr('href');
}

});

torrent_title = find_torrent_title.text();
torrent_size = find_torrent_size.text();
torrent_seed = find_torrent_seeders.text();
torrent_leech = find_torrent_leechers.text();
date_added = find_date_added.text();

data_content = {
torrent_num: count,
title: torrent_title,
category: '',
seeds: torrent_seed,
leechs: torrent_leech,
size: torrent_size,
torrent_link: torrent_link,
date_added: date_added
};


torrent_content.push(data_content);

deferred.resolve(torrent_content);
// like break
if (++count > limit) { return false; }
});
} else {
deferred.reject("No torrents found");
}
} else {
deferred.reject("There was a problem loading Zooqle");
}

});

return deferred.promise;

}
};

0 comments on commit 0b7ae6e

Please sign in to comment.