Skip to content

Commit

Permalink
Merge branch 'master' of github.com:ItzBlitz98/torrentflix
Browse files Browse the repository at this point in the history
  • Loading branch information
ItzBlitz98 committed Dec 6, 2015
2 parents f724bc8 + f854e01 commit 5a459cf
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A cli tool for searching torrent sites and streaming using peerflix.

It currently supports kickasstorrents, 1337x, seedpeer, Rarbg, The Pirate Bay, YTS, Extratorrent, Limetorrents, nyaa.se, tokyotosho & Cpasbien.
It currently supports kickasstorrents, 1337x, seedpeer, Rarbg, The Pirate Bay, YTS, Extratorrent, Limetorrents, nyaa.se, tokyotosho, Cpasbien & eztv.

Want more ? Create an issue with a request, Alternatively you can contribute your own scrapers.

Expand Down
5 changes: 5 additions & 0 deletions lib/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
conf.set("nyaa_url", "http://www.nyaa.se");
conf.set("tokyotosho_url", "https://www.tokyotosho.info");
conf.set("cpasbien_url", "http://www.cpasbien.pw");
conf.set("eztv_url", "https://www.eztv.ag");
conf.set("rarbg_api_url", "https://torrentapi.org");
conf.set("peerflix_player", "--vlc");
conf.set("peerflix_player_args", "");
Expand All @@ -121,6 +122,10 @@
conf.set("cpasbien_url", "http://www.cpasbien.pw");
}

if(!conf.get("eztv_url")){
conf.set("eztv_url", "https://www.eztv.ag");
}

if(!conf.get("peerflix_path")){
conf.set("peerflix_path", "");
}
Expand Down
74 changes: 74 additions & 0 deletions lib/eztv.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
var Q = require('q');
var request = require("request");
var cheerio = require('cheerio');
var moment = require('moment');
var util = require('util');
var fs = require('fs');

module.exports = {
search: function(query, eztv_url) {

var torrent_search = query;
var search_query = torrent_search.split(' ').join('-');
var search_url = eztv_url + "/search/" + search_query;
var count = 1;
var deferred = Q.defer();
var data_content = {};
var torrent_content = [];

request({ url: search_url, headers:{ "User-Agent": "request"}}, function(err, response, body){

// fs.writeFileSync("/home/serge/torrentsearch/out2.html", body);
// fs.readFile("/home/serge/torrentsearch/out.html", function(err, body){
// var response = { statusCode: 200 };
try {

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

var eztv_link, torrent_title, torrent_size, torrent_seeds, torrent_leech, date_added;
$ = cheerio.load(body);
if($("tr.forum_header_border").length > 0) {

$("tr.forum_header_border").each(function(index, torrent){
eztv_link = $(torrent).find("a.magnet").attr('href');
torrent_title = $(torrent).find("a.epinfo").text();
torrent_size = $(torrent).find("a.epinfo").attr("title").match(/\([^)]+\)$/)[0].slice(1,-1);
//torrent_seeds = $(torrent).find(".seed").text();
//torrent_leech = $(torrent).find(".leech").text();
date_added = $("td.forum_thread_post_end", torrent).prev().text();

data_content = {
torrent_num: count,
title: torrent_title,
category: "",
seeds: torrent_seeds,
leechs: torrent_leech,
size: torrent_size,
torrent_link: eztv_link,
date_added: date_added
};

torrent_content.push(data_content);

deferred.resolve(torrent_content);
count++;
});

} else {
deferred.reject("No torrents found");
}

} else {
deferred.reject("There was a problem loading Eztv");
}

} catch(e) {
deferred.reject(e.toString());
}

});

return deferred.promise;

}
};
16 changes: 16 additions & 0 deletions lib/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
var nyaa = require('./nyaa.js');
var tokyotosho = require('./tokyotosho.js');
var cpasbien = require('./cpasbien.js');
var eztv = require('./eztv.js');
var tparse = require('./torrent_parse.js');
var language = require('../lang.js');
var chalk = require('chalk');
Expand Down Expand Up @@ -65,6 +66,7 @@
btdigg_url = config_object.btdigg_url;
tokyotosho_url = config_object.tokyotosho_url;
cpasbien_url = config_object.cpasbien_url;
eztv_url = config_object.eztv_url;
strike_url = config_object.strike_url;
peerflix_player = config_object.peerflix_player;
peerflix_player_arg = config_object.peerflix_player_args;
Expand Down Expand Up @@ -124,6 +126,9 @@
if(cpasbien_url){
sites.push({'key': "cpasbien", name: chalk.magenta('Cpasbien'), value: "cpasbien"});
}
if(eztv_url){
sites.push({'key': "eztv", name: chalk.magenta('Eztv'), value: "eztv"});
}
if(history === "true"){
sites.push({'key': "print history", name: chalk.blue('Print history'), value: "print history"});
}
Expand Down Expand Up @@ -191,6 +196,8 @@
tokyotoshoSearch(search);
} else if(site === "cpasbien"){
cpasbienSearch(search);
} else if(site === "eztv"){
eztvSearch(search);
}
}

Expand Down Expand Up @@ -322,6 +329,15 @@
});
}

function eztvSearch(query){
eztv.search(query, eztv_url).then(
function (data) {
onResolve(data);
}, function (err) {
onReject(err);
});
}

function onResolve(data) {
for (var idx in data) {
var torrent = data[idx];
Expand Down

0 comments on commit 5a459cf

Please sign in to comment.