Esempio n. 1
0
from updatorr.handler_base import GenericPublicTrackerHandler
from updatorr.utils import register_tracker_handler


class RutorHandler(GenericPublicTrackerHandler):
    """This class implements .torrent files downloads
    for http://rutor.org tracker."""
    def get_download_link(self):
        """Tries to find .torrent file download link at forum thread page
        and return that one."""
        linkToFind = 'd.rutor.org/download/%s' % self.get_id_from_link()
        response, page_html = self.get_resource(self.resource_url)
        page_links = self.find_links(page_html)
        download_link = None
        for page_link in page_links:
            if linkToFind in page_link:
                download_link = page_link
                break
        return download_link


register_tracker_handler('rutor.org', RutorHandler)
Esempio n. 2
0
from updatorr.handler_base import GenericPrivateTrackerHandler
from updatorr.utils import register_tracker_handler
import urllib2


class AnidubHandler(GenericPrivateTrackerHandler):
    """This class implements .torrent files downloads
    for http://tr.anidub.com tracker."""

    login_url = 'http://tr.anidub.com/takelogin.php'
    cookie_logged_in = 'uid'

    def get_download_link(self):
        """Tries to find .torrent file download link at forum thread page
        and return that one."""
        response, page_html = self.get_resource(self.resource_url)
        page_links = self.find_links(page_html)
        download_link = None
        for page_link in page_links:
            if 'login.php?returnto=' in page_link:
                download_link = None
                self.debug('Login is required to download torrent file.')
                if self.login(self.get_settings('login'), self.get_settings('password')):
                    download_link = self.get_download_link()
            if 'download.php?id=' in page_link:
                download_link = 'http://tr.anidub.com/%s' % urllib2.unquote(page_link).replace('&', '&')
        return download_link

register_tracker_handler('tr.anidub.com', AnidubHandler)
Esempio n. 3
0
import urllib2


class AnidubHandler(GenericPrivateTrackerHandler):
    """This class implements .torrent files downloads
    for http://tr.anidub.com tracker."""

    login_url = 'http://tr.anidub.com/takelogin.php'
    cookie_logged_in = 'uid'

    def get_download_link(self):
        """Tries to find .torrent file download link at forum thread page
        and return that one."""
        response, page_html = self.get_resource(self.resource_url)
        page_links = self.find_links(page_html)
        download_link = None
        for page_link in page_links:
            if 'login.php?returnto=' in page_link:
                download_link = None
                self.debug('Login is required to download torrent file.')
                if self.login(self.get_settings('login'),
                              self.get_settings('password')):
                    download_link = self.get_download_link()
            if 'download.php?id=' in page_link:
                download_link = 'http://tr.anidub.com/%s' % urllib2.unquote(
                    page_link).replace('&', '&')
        return download_link


register_tracker_handler('tr.anidub.com', AnidubHandler)
    login_url = 'http://login.rutracker.org/forum/login.php'
    cookie_logged_in = 'bb_data'

    def get_login_form_data(self, login, password):
        """Returns a dictionary with data to be pushed to authorization form."""
        return {'login_username': login, 'login_password': password, 'login': '******'}

    def before_download(self):
        """Used to perform some required actions right before .torrent download."""
        self.set_cookie('bb_dl', self.get_id_from_link())  # A check that user himself have visited torrent's page ;)

    def get_download_link(self):
        """Tries to find .torrent file download link at forum thread page
        and return that one."""
        response, page_html = self.get_resource(self.resource_url)
        page_links = self.find_links(page_html)
        download_link = None
        for page_link in page_links:
            if 'dl.rutracker.org' in page_link:
                download_link = page_link
                if 'guest' in download_link:
                    download_link = None
                    self.debug('Login is required to download torrent file.')
                    if self.login(self.get_settings('login'), self.get_settings('password')):
                        download_link = self.get_download_link()
                break
        return download_link

# With that one we tell updatetorr to handle links to `rutracker.org` domain with RutrackerHandler class.
register_tracker_handler('rutracker.org', RutrackerHandler)