Example #1
0
<?php

class RuTrackerCheckImpl
{
    public static function download_torrent($url, $hash, $old_torrent)
    {
        if (preg_match('`^http://rutracker\\.org/forum/viewtopic\\.php\\?t=(?P<id>\\d+)$`', $url, $matches)) {
            $topic_id = $matches["id"];
            $req_url = "http://api.rutracker.org/v1/get_tor_hash?by=topic_id&val=" . $topic_id;
            $client = ruTrackerChecker::makeClient($req_url);
            if ($client->status == 200) {
                $ret = json_decode($client->results, true);
                if (array_key_exists("result", $ret)) {
                    $ret = $ret["result"];
                }
                if ($ret && array_key_exists($topic_id, $ret) && strtoupper($ret[$topic_id]) == $hash) {
                    return ruTrackerChecker::STE_UPTODATE;
                }
            }
            $client->setcookies();
            $client->fetchComplex("http://dl.rutracker.org/forum/dl.php?t=" . $topic_id);
            if ($client->status !== 200) {
                return $client->status < 0 ? ruTrackerChecker::STE_CANT_REACH_TRACKER : ruTrackerChecker::STE_DELETED;
            }
            return ruTrackerChecker::createTorrent($client->results, $hash);
        }
        return ruTrackerChecker::STE_NOT_NEED;
    }
}
ruTrackerChecker::registerTracker("rutracker.org", "RuTrackerCheckImpl::download_torrent");
Example #2
0
class RuTrackerCheckImpl
{
    public static function download_torrent($url, $hash, $old_torrent)
    {
        if (preg_match('`^https?://rutracker\\.(org|cr|net)/forum/viewtopic\\.php\\?t=(?P<id>\\d+)$`', $url, $matches)) {
            $topic_id = $matches["id"];
            $req_url = "http://api.rutracker.cr/v1/get_tor_hash?by=topic_id&val=" . $topic_id;
            $client = ruTrackerChecker::makeClient($req_url);
            if ($client->status != 200) {
                return ruTrackerChecker::STE_CANT_REACH_TRACKER;
            }
            $ret = json_decode($client->results, true);
            if (array_key_exists("result", $ret)) {
                $ret = $ret["result"];
            }
            if ($ret && array_key_exists($topic_id, $ret) && strtoupper($ret[$topic_id]) == $hash) {
                return ruTrackerChecker::STE_UPTODATE;
            }
            $client->setcookies();
            $client->fetchComplex("http://dl.rutracker.cr/forum/dl.php?t=" . $topic_id);
            if ($client->status != 200) {
                return $client->status < 0 ? ruTrackerChecker::STE_CANT_REACH_TRACKER : ruTrackerChecker::STE_DELETED;
            }
            return ruTrackerChecker::createTorrent($client->results, $hash);
        }
        return ruTrackerChecker::STE_NOT_NEED;
    }
}
ruTrackerChecker::registerTracker("/rutracker\\./", "/rutracker\\.|t-ru\\.org/", "RuTrackerCheckImpl::download_torrent");
Example #3
0
<?php

class TfileCheckImpl
{
    public static function download_torrent($url, $hash, $old_torrent)
    {
        $client = ruTrackerChecker::makeClient($url);
        if ($client->status != 200) {
            return ruTrackerChecker::STE_CANT_REACH_TRACKER;
        }
        if (preg_match('`Info hash:</td><td><strong>(?P<hash>[0-9A-Fa-f]{40})</strong></td>`', $client->results, $matches)) {
            if (strtoupper($matches["hash"]) == $hash) {
                return ruTrackerChecker::STE_UPTODATE;
            }
            if (preg_match('`\\"download.php\\?id=(?P<id>\\d+)`', $client->results, $matches)) {
                $client->setcookies();
                $client->fetchComplex("http://tfile.co/forum/download.php?id=" . $matches["id"]);
                if ($client->status != 200) {
                    return $client->status < 0 ? ruTrackerChecker::STE_CANT_REACH_TRACKER : ruTrackerChecker::STE_DELETED;
                }
                return ruTrackerChecker::createTorrent($client->results, $hash);
            }
        }
        return ruTrackerChecker::STE_NOT_NEED;
    }
}
ruTrackerChecker::registerTracker("/tfile\\./", "/tfile\\./", "TfileCheckImpl::download_torrent");
Example #4
0
<?php

class KinozalCheckImpl
{
    public static function download_torrent($url, $hash, $old_torrent)
    {
        if (preg_match('`^http://(?P<tracker>kinozal)\\.tv/details\\.php\\?id=(?P<id>\\d+)$`', $url, $matches)) {
            $topic_id = $matches["id"];
            $client = ruTrackerChecker::makeClient("http://kinozal.tv/get_srv_details.php?action=2&id=" . $topic_id);
            if ($client->status == 200 && preg_match('`<li>.*(?P<hash>[0-9A-Fa-f]{40})</li>`', $client->results, $matches1)) {
                if (strtoupper($matches1["hash"]) == $hash) {
                    return ruTrackerChecker::STE_UPTODATE;
                }
            }
            $client->setcookies();
            $client->fetchComplex("http://dl.kinozal.tv/download.php?id=" . $matches["id"]);
            if ($client->status != 200) {
                return $client->status < 0 ? ruTrackerChecker::STE_CANT_REACH_TRACKER : ruTrackerChecker::STE_DELETED;
            }
            return ruTrackerChecker::createTorrent($client->results, $hash);
        }
        return ruTrackerChecker::STE_NOT_NEED;
    }
}
ruTrackerChecker::registerTracker("/kinozal\\.tv/", "/kinozal\\.tv|torrent4me\\.com/", "KinozalCheckImpl::download_torrent");
Example #5
0
            // ToDo: if torrent doesn't contain any quality tag, try to guess in other ways
            # exit, no way to get torrent file without this
            if ($torrent_quality === null) {
                return ruTrackerChecker::STE_NOT_NEED;
            }
            $client = ruTrackerChecker::makeClient($url);
            if ($client->status != 200) {
                return ruTrackerChecker::STE_CANT_REACH_TRACKER;
            }
            $resp = preg_replace("/\r|\n/", "", $client->results);
            $q = $torrent_quality_type . $torrent_quality;
            // e.g. tv.720
            $pattern = sprintf('/\\<div\\sid\\=\\"%s\\"\\>\\<div\\sid=\'[\\d\\w\\_]+\'\\>\\s+\\<div\\sclass=\\"torrent\\_h\\"\\>\\s+\\<a\\shref=\\"(?P<url>[\\w\\d\\_\\/\\.\\=\\?]+)\\"\\s/i', $q);
            if (!preg_match($pattern, $resp, $url_matches)) {
                ruTrackerChecker::STE_CANT_REACH_TRACKER;
            }
            if (!preg_match('/\\/engine\\/download\\.php\\?id=\\d{1,10}/i', $url_matches["url"], $m)) {
                ruTrackerChecker::STE_CANT_REACH_TRACKER;
            }
            $client->setcookies();
            $client->fetchComplex("http://tr.anidub.com" . $url_matches["url"]);
            if (intval($client->status) != 200) {
                return $client->status < 0 ? ruTrackerChecker::STE_CANT_REACH_TRACKER : ruTrackerChecker::STE_DELETED;
            }
            return ruTrackerChecker::createTorrent($client->results, $hash);
        }
        return ruTrackerChecker::STE_NOT_NEED;
    }
}
ruTrackerChecker::registerTracker("/tr\\.anidub\\.com/", "/tr\\.anidub\\.com/", "AniDUBCheckImpl::download_torrent");
Example #6
0
<?php

class KinozalCheckImpl
{
    public static function download_torrent($url, $hash, $old_torrent)
    {
        if (preg_match('`^http://(?P<tracker>kinozal)\\.tv/details\\.php\\?id=(?P<id>\\d+)$`', $url, $matches)) {
            $topic_id = $matches["id"];
            $client = ruTrackerChecker::makeClient("http://kinozal.tv/get_srv_details.php?action=2&id=" . $topic_id);
            if ($client->status == 200 && preg_match('`<li>.*(?P<hash>[0-9A-Fa-f]{40})</li>`', $client->results, $matches1)) {
                if (strtoupper($matches1["hash"]) == $hash) {
                    return ruTrackerChecker::STE_UPTODATE;
                }
            }
            $client->setcookies();
            $client->fetchComplex("http://dl.kinozal.tv/download.php?id=" . $matches["id"]);
            if ($client->status !== 200) {
                return $client->status < 0 ? ruTrackerChecker::STE_CANT_REACH_TRACKER : ruTrackerChecker::STE_DELETED;
            }
            return ruTrackerChecker::createTorrent($client->results, $hash);
        }
        return ruTrackerChecker::STE_NOT_NEED;
    }
}
ruTrackerChecker::registerTracker("kinozal.tv", "KinozalCheckImpl::download_torrent");
Example #7
0
            // ToDo: if torrent doesn't contain any quality tag, try to guess in other ways
            # exit, no way to get torrent file without this
            if ($torrent_quality === null) {
                return ruTrackerChecker::STE_NOT_NEED;
            }
            $client = ruTrackerChecker::makeClient($url);
            if ($client->status != 200) {
                return ruTrackerChecker::STE_CANT_REACH_TRACKER;
            }
            $resp = preg_replace("/\r|\n/", "", $client->results);
            $q = $torrent_quality_type . $torrent_quality;
            // e.g. tv.720
            $pattern = sprintf('/\\<div\\sid\\=\\"%s\\"\\>\\<div\\sid=\'[\\d\\w\\_]+\'\\>\\s+\\<div\\sclass=\\"torrent\\_h\\"\\>\\s+\\<a\\shref=\\"(?P<url>[\\w\\d\\_\\/\\.\\=\\?]+)\\"\\s/i', $q);
            if (!preg_match($pattern, $resp, $url_matches)) {
                ruTrackerChecker::STE_CANT_REACH_TRACKER;
            }
            if (!preg_match('/\\/engine\\/download\\.php\\?id=\\d{1,10}/i', $url_matches["url"], $m)) {
                ruTrackerChecker::STE_CANT_REACH_TRACKER;
            }
            $client->setcookies();
            $client->fetchComplex("http://tr.anidub.com" . $url_matches["url"]);
            if (intval($client->status) != 200) {
                return $client->status < 0 ? ruTrackerChecker::STE_CANT_REACH_TRACKER : ruTrackerChecker::STE_DELETED;
            }
            return ruTrackerChecker::createTorrent($client->results, $hash);
        }
        return ruTrackerChecker::STE_NOT_NEED;
    }
}
ruTrackerChecker::registerTracker("tr.anidub.com", "AniDUBCheckImpl::download_torrent");
Example #8
0
<?php

class TapochekNetCheckImpl
{
    public static function download_torrent($url, $hash, $old_torrent)
    {
        $client = ruTrackerChecker::makeClient($url);
        if ($client->status != 200) {
            return ruTrackerChecker::STE_CANT_REACH_TRACKER;
        }
        if (preg_match('`btih:(?P<hash>[0-9A-Fa-f]{40})&dn`', $client->results, $matches)) {
            if (strtoupper($matches["hash"]) == $hash) {
                return ruTrackerChecker::STE_UPTODATE;
            }
            if (preg_match('`\\"download.php\\?id=(?P<id>\\d+)\\"`', $client->results, $matches)) {
                $client->setcookies();
                $client->fetchComplex("http://tapochek.net/download.php?id=" . $matches["id"]);
                if ($client->status != 200) {
                    return $client->status < 0 ? ruTrackerChecker::STE_CANT_REACH_TRACKER : ruTrackerChecker::STE_DELETED;
                }
                return ruTrackerChecker::createTorrent($client->results, $hash);
            }
        }
        return ruTrackerChecker::STE_NOT_NEED;
    }
}
ruTrackerChecker::registerTracker("/tapochek\\.net/", "/tapochek\\.net/", "TapochekNetCheckImpl::download_torrent");
Example #9
0
<?php

class NNMClubCheckImpl
{
    public static function download_torrent($url, $hash, $old_torrent)
    {
        $client = ruTrackerChecker::makeClient($url);
        if ($client->status != 200) {
            return ruTrackerChecker::STE_CANT_REACH_TRACKER;
        }
        if (preg_match('`btih:(?P<hash>[0-9A-Fa-f]{40})&tr`', $client->results, $matches)) {
            if (strtoupper($matches["hash"]) == $hash) {
                return ruTrackerChecker::STE_UPTODATE;
            }
            if (preg_match('`\\"download.php\\?id=(?P<id>\\d+)\\"`', $client->results, $matches)) {
                $client->setcookies();
                $client->fetchComplex("http://nnm-club.ws/download.php?id=" . $matches["id"]);
                if ($client->status != 200) {
                    return $client->status < 0 ? ruTrackerChecker::STE_CANT_REACH_TRACKER : ruTrackerChecker::STE_DELETED;
                }
                return ruTrackerChecker::createTorrent($client->results, $hash);
            }
        }
        return ruTrackerChecker::STE_NOT_NEED;
    }
}
ruTrackerChecker::registerTracker("/(nnm-club|nnmclub)\\./", "/nnm-club\\./", "NNMClubCheckImpl::download_torrent");