Exemplo n.º 1
0
    def fetch_versions(self):
        if self.versions:
            return

        result = session.get(self.url)
        tables = result('.tabel95')
        self.title = tables.find('.titulo').contents()[0].strip()

        for i, table in enumerate(tables[2:-1:2]):
            trs = query(table)('tr')

            release = encode(trs.find('.NewsTitle').text().partition(',')[0])
            release = re.sub('version ', '', release, 0, re.I)

            infos = encode(trs.next().find('.newsDate').eq(0).text())
            infos = re.sub('(?:should)? works? with ', '', infos, 0, re.I)

            for tr in trs[2:]:
                tr = query(tr)
                language = tr('.language')
                if not language:
                    continue

                completeness = encode(language.next().text().partition(' ')[0])
                language = encode(language.text())
                download = tr('a[href*=updated]') or tr('a[href*=original]')
                if not download:
                    continue
                hearing_impaired = \
                    bool(tr.next().find('img[title="Hearing Impaired"]'))
                download = encode(download.attr.href)
                self.add_version(download, language, release, infos,
                                 completeness, hearing_impaired)
Exemplo n.º 2
0
    def fetch_versions(self):
        if self.versions:
            return

        result = session.get(self.url)
        tables = result('.tabel95')
        self.title = tables.find('.titulo').contents()[0].strip()

        for i, table in enumerate(tables[2:-1:2]):
            trs = query(table)('tr')

            release = encode(trs.find('.NewsTitle').text().partition(',')[0])
            release = re.sub('version ', '', release, 0, re.I)

            infos = encode(trs.next().find('.newsDate').eq(0).text())
            infos = re.sub('(?:should)? works? with ', '', infos, 0, re.I)

            for tr in trs[2:]:
                tr = query(tr)
                language = tr('.language')
                if not language:
                    continue

                completeness = encode(language.next().text().partition(' ')[0])
                language = encode(language.text())
                download = tr('a[href*=updated]') or tr('a[href*=original]')
                if not download:
                    continue
                hearing_impaired = \
                    bool(tr.next().find('img[title="Hearing Impaired"]'))
                download = encode(download.attr.href)
                self.add_version(download, language, release, infos,
                                 completeness, hearing_impaired)
Exemplo n.º 3
0
def search(query):
    results = session.get('/search.php',
                          params={'search': query, 'submit': 'Search'})
    last_url = session.last_url
    if '/search.php' in last_url:
        return [
            Episode(quote(encode(link.attrib['href'])),
                    encode(link.text))
            for link in results('.tabel a')
        ]
    else:
        title = encode(results('.titulo').contents()[0]).strip()
        return [Episode(last_url, title, page=results)]
Exemplo n.º 4
0
def search(query):
    results = session.get('/search.php',
                          params={
                              'search': query,
                              'Submit': 'Search'
                          })
    last_url = session.last_url
    if '/search.php' in last_url:
        return [
            Episode(quote(encode(link.attrib['href'])), encode(link.text))
            for link in results('.tabel a')
        ]
    else:
        title = encode(results('.titulo').contents()[0]).strip()
        return [Episode(last_url, title, page=results)]