コード例 #1
0
    def __init__(self, expire=0, size=0):

        self.cache_catalog = Cache('rutracker_catalog.db')
        self.cache_profile = Cache('rutracker_profile.db', expire, size)

        self.http = RuTrackerHTTP()

        self.re = {
            'is_int': re.compile(r'^([0-9]+)', re.U),
            'is_float': re.compile(r'^([0-9]{1,10}\.[0-9]+)', re.U),
            'hash': re.compile(r'<span id="tor-hash">([0-9A-F]{40})</span>',
                               re.U)
        }

        self.html = Clear()

        self.status = {
            '%': 'check',
            'D': 'repeat',
            '!': 'nodesc',
            '&copy;': 'copyright',
            '&#8719;': 'moder',
            'x': 'close',
            '&sum;': 'absorb',
            '#': 'doubtful',
            '*': 'nocheck',
            '?': 'neededit',
            'T': 'temp',
            '&radic;': 'ok'
        }
コード例 #2
0
 def __init__(self):
     self.cache = Cache('kinopoisk.db')
     self.html = Clear()
     
     self.http = HTTP()
     self.headers = {
         'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; rv:10.0.2) Gecko/20100101 Firefox/10.0.2',
         'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
         'Accept-Language': 'ru-ru,ru;q=0.8,en-us;q=0.5,en;q=0.3',
         'Cache-Control': 'no-cache',
         'Referer': 'http://www.kinopoisk.ru/level/7/'
     }