pillone / usntssearch

NZB Metasearch engine
pillone.github.io/usntssearch
265 stars 79 forks source link

Nzb.to #100

Open lukasmd1989 opened 10 years ago

lukasmd1989 commented 10 years ago

Hi,

Can you add nzb.to as provider. Maybe this php-Script can help you:

<?php //get vars from url request... $user = $_GET["user"]; $pass = $_GET["pass"]; $nid = $_GET["nid"]; $rel = rawurldecode($_GET["rel"]);

//if a var is missing, die and send a error if(!$user or !$pass or !$nid) { die("Sorry check your user details"); }

$cookie = 'cookie.txt'; $url = "http://nzb.to/login.php";

$ch = curl_init();

curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6"); curl_setopt ($ch, CURLOPT_TIMEOUT, 60); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_COOKIEJAR, $cookie); curl_setopt ($ch, CURLOPT_COOKIEFILE, $cookie); curl_setopt ($ch, CURLOPT_REFERER, $url);

curl_setopt ($ch, CURLOPT_POST, 1); // Postdata to send for the login attempt $postdata = array( 'action' => 'login.php', 'username'=> $user, 'password'=> $pass, 'bind_ip' => '1', 'Submit' => '.%3AEinloggen%3A.', 'ret_url' => '', ); //Tell curl we're going to send $postdata as the POST data curl_setopt($ch, CURLOPT_POSTFIELDS, $postdata); $login = curl_exec($ch); $headers = curl_getinfo($ch);

//after login, call download page for the given NZB file curl_setopt($ch, CURLOPT_URL, "http://nzb.to/download.php?nid=".$nid); $result = curl_exec($ch); curl_close($ch);

//if content is xml/nzb set content to xml and show it, else die and delete cookie file if (substr($result,0,5) == '<?xml') {

//set header for nzb-file
header('Content-type: application/x-nzb');
if ($rel) {
    //set filename to release name
    header('Content-Disposition: attachment; filename="'.$rel.'.nzb"');
}
ob_clean();
flush();
echo $result;

} else { echo "Sorry, unable to get NZB"; echo unlink($cookie); } ?>

Greets crush

pillone commented 10 years ago

I see what I can do, but the fact of not being a member makes the entire debug process rather brittle.

Do you want to be beta tester of that?

lukasmd1989 commented 10 years ago

Sorry i dont have a NZb.to account ether..i found this script at the cytec.us forum

lg crush

d0wnbiz commented 10 years ago

Hey, pillone your work is great :) I have a nzb.to account. So maybe you could contact me and we see what we could do.

Kind regards Martin

pillone commented 10 years ago

thanks :) are you willing to test it? In such case, i will include it.

d0wnbiz commented 10 years ago

a friend just coded some nzb.to "module" and it works ;-)

cytec commented 10 years ago

shouldn't be that difficult to make this thing work, mostly parse the website with BeautifulSoup, what you already do in some other providers...

maybe have a look at my SickBeard provider for nzb.to here https://github.com/cytec/Sick-Beard/blob/development/sickbeard/providers/nzbto.py

the php proxy is only needed if you want to send the file direktly to sab because it has no option to log in and download the nzb there