예제 #1
0
파일: main.py 프로젝트: Inter95/tutvguia
def extract_torrents(data):
    try:
        filters.information()  # print filters settings
        data = common.clean_html(data)
        data = data[data.find('Search in :'):]
        data = data.replace('<strong>', '').replace('</strong>', '').replace('\n', '').replace('\t', '').replace(
            '<font color="#008000">', '').replace('<font color="#000080">', '').replace('</font>', '')
        rows = re.findall('<td class="trow" align="center">(.*?)</td>', data, re.S)
        size = rows[3::6]
        seeds = rows[4::6]
        peers = rows[5::6]
        cont = 0
        results = []
        for cm, line in enumerate(re.findall('/download/(.*?)\.torrent', data)):
            torrent = '%s/torrent_download/%s.torrent' % (settings.url, line.replace(' ', '+'))
            name = size[cm] + ' - ' + line.split('/')[-1].split('_')[0] + ' - ' + settings.name_provider
            if filters.verify(name, size[cm]):
                results.append({"name": name, "uri": torrent,
                                "size": common.size_int(size[cm]),
                                "seeds": int(seeds[cm]), "peers": int(peers[cm]),
                                "language": settings.language})  # return le torrent
                cont += 1
            else:
                provider.log.warning(filters.reason)
            if cont == settings.max_magnets:  # limit magnets
                break
        provider.log.info('>>>>>>' + str(cont) + ' torrents sent to Pulsar<<<<<<<')
        return results
    except:
        provider.log.error('>>>>>>>ERROR parsing data<<<<<<<')
        provider.notify(message='ERROR parsing data', header=None, time=5000, image=settings.icon)
        results = []
def extract_torrents(data):
    try:
        filters.information()  # print filters settings
        data = common.clean_html(data)
        size = re.findall('Size (.*?)B', data) # list the size
        seedsPeers = re.findall('<td align="right">(.*?)</td>', data)  # list the size
        seeds = seedsPeers[0:][::2]
        peers = seedsPeers[1:][::2]
        cont = 0
        results = []
        for cm, magnet in enumerate(re.findall(r'magnet:\?[^\'"\s<>\[\]]+', data)):
            info = common.Magnet(magnet)
            name = size[cm].replace('&nbsp;',' ') + 'B' + ' - ' + info.name + ' - ' + settings.name_provider
            if filters.verify(name, size[cm].replace('&nbsp;', ' ')):
                    results.append({"name": name, "uri": magnet, "info_hash": info.hash,
                                     "size": common.size_int(size[cm].replace('&nbsp;', ' ')),
                                     "seeds": int(seeds[cm]), "peers": int(peers[cm]),
                                     "language": settings.language})  # return le torrent
                    cont += 1
            else:
                provider.log.warning(filters.reason)
            if cont == settings.max_magnets:  # limit magnets
                break
        provider.log.info('>>>>>>' + str(cont) + ' torrents sent to Pulsar<<<<<<<')
        return results
    except:
        provider.log.error('>>>>>>>ERROR parsing data<<<<<<<')
        provider.notify(message='ERROR parsing data', header=None, time=5000, image=settings.icon)
예제 #3
0
def extract_torrents(data):
    try:
        filters.information()  # print filters settings
        data = common.clean_html(data).replace('<td data-href="magnet:?', '')
        lname = re.findall('<td data-href="/torrent/(.*?)/(.*?)"', data)  # list the size
        size = re.findall('<td class="size_td">(.*?)</td>', data)  # list the size
        seeds = re.findall('<td class="seed_td">(.*?)</td>', data)  # list the seeds
        peers = re.findall('<td class="leech_td">(.*?)</td>', data)  # list the seeds
        cont = 0
        results = []
        for cm, magnet in enumerate(re.findall(r'magnet:\?[^\'"\s<>\[\]]+', data)):
            info_magnet = common.Magnet(magnet)
            name = size[cm] + ' - ' + lname[cm][1].replace('-', ' ') + ' - ' + settings.name_provider #find name in the torrent
            if filters.verify(name,size[cm]):
                results.append({"name": name, "uri": magnet, "info_hash": info_magnet.hash,
                                "size": common.size_int(size[cm]), "seeds": int(seeds[cm]), "peers": int(peers[cm]),
                                "language": settings.language
                                })  # return le torrent
                cont += 1
            else:
                provider.log.warning(filters.reason)
            if cont == settings.max_magnets:  # limit magnets
                break
        provider.log.info('>>>>>>' + str(cont) + ' torrents sent to Pulsar<<<<<<<')
        return results
    except:
        provider.log.error('>>>>>>>ERROR parsing data<<<<<<<')
        provider.notify(message='ERROR parsing data', header=None, time=5000, image=settings.icon)
def extract_torrents(data):
    try:
        filters.information()  # print filters settings
        data = common.clean_html(data)
        cont = 0
        results = []
        for row in re.findall('<div class="torrent">(.*?)</div>', data, re.S):
            size = re.search('size">(.*?)<', row).group(1)
            name = ' - ' + size + ' - ' + re.search("title='(.*?)'", row).group(1) + ' - ' + settings.name_provider #find name in the torrent
            infohash = re.search('http://(.*?)/(.*?)/', row).group(2)
            torrent = 'magnet:?xt=urn:btih:%s' % infohash
            seeds_peers = re.findall('<b>(.*?)<', row)
            seeds = seeds_peers[0]
            peers = seeds_peers[1]
            if filters.verify(name,size):
                    results.append({"name": name, "uri": torrent, "info_hash": infohash,
                                    "size": common.size_int(size), "seeds": int(seeds),
                                    "peers": int(peers), "language": settings.language
                                    })  # return le torrent
                    cont+= 1
            else:
                provider.log.warning(filters.reason)
            if cont == settings.max_magnets:  # limit magnets
                break
        provider.log.info('>>>>>>' + str(cont) + ' torrents sent to Pulsar<<<<<<<')
        return results
    except:
        provider.log.error('>>>>>>>ERROR parsing data<<<<<<<')
        provider.notify(message='ERROR parsing data', header=None, time=5000, image=settings.icon)
예제 #5
0
def extract_torrents(data):
    try:
        filters.information()  # print filters settings
        data = common.clean_html(data)
        size = re.findall('Size (.*?)B', data)  # list the size
        seedsPeers = re.findall('<td align="right">(.*?)</td>',
                                data)  # list the size
        seeds = seedsPeers[0:][::2]
        peers = seedsPeers[1:][::2]
        cont = 0
        results = []
        for cm, magnet in enumerate(
                re.findall(r'magnet:\?[^\'"\s<>\[\]]+', data)):
            info = common.Magnet(magnet)
            name = size[cm].replace(
                '&nbsp;',
                ' ') + 'B' + ' - ' + info.name + ' - ' + settings.name_provider
            if filters.verify(name, size[cm].replace('&nbsp;', ' ')):
                results.append({
                    "name":
                    name,
                    "uri":
                    magnet,
                    "info_hash":
                    info.hash,
                    "size":
                    common.size_int(size[cm].replace('&nbsp;', ' ')),
                    "seeds":
                    int(seeds[cm]),
                    "peers":
                    int(peers[cm]),
                    "language":
                    settings.language
                })  # return le torrent
                cont += 1
            else:
                provider.log.warning(filters.reason)
            if cont == settings.max_magnets:  # limit magnets
                break
        provider.log.info('>>>>>>' + str(cont) +
                          ' torrents sent to Pulsar<<<<<<<')
        return results
    except:
        provider.log.error('>>>>>>>ERROR parsing data<<<<<<<')
        provider.notify(message='ERROR parsing data',
                        header=None,
                        time=5000,
                        image=settings.icon)
예제 #6
0
파일: main.py 프로젝트: Inter95/tutvguia
def extract_torrents(data):
    try:
        filters.information()  # print filters settings
        data = common.clean_html(data)
        data = (
            data[data.find("peers") :]
            .replace("<b>", "")
            .replace("</b>", "")
            .replace('class="pe">Pending', 'class="s">0 MB')
        )  # short
        # the result
        size = re.findall('class="s">(.*?)</span>', data)  # list the size
        seeds = re.findall('class="u">(.*?)</span>', data)  # list the seeds
        peers = re.findall('class="d">(.*?)</span>', data)  # list the seeds
        cont = 0
        results = []
        for cm, (infohash, name) in enumerate(re.findall('<dl><dt><a href="/(.*?)">(.*?)<', data)):
            torrent = "magnet:?xt=urn:btih:%s" % infohash
            name = size[cm] + " - " + name.replace("-", " ").title() + " - " + settings.name_provider  # find name in
            #  the torrent
            if filters.verify(name, size[cm]):
                results.append(
                    {
                        "name": name,
                        "uri": torrent,
                        "info_hash": infohash,
                        "size": common.size_int(size[cm]),
                        "seeds": int(seeds[cm].replace(",", "")),
                        "peers": int(peers[cm].replace(",", "")),
                        "language": settings.language,
                    }
                )  # return le torrent
                cont += 1
            else:
                provider.log.warning(filters.reason)
            if cont == settings.max_magnets:  # limit magnets
                break
        provider.log.info(">>>>>>" + str(cont) + " torrents sent to Pulsar<<<<<<<")
        return results
    except:
        provider.log.error(">>>>>>>ERROR parsing data<<<<<<<")
        provider.notify(message="ERROR parsing data", header=None, time=5000, image=settings.icon)
        return []
예제 #7
0
def extract_torrents(data):
    try:
        filters.information()  # print filters settings
        data = common.clean_html(data)
        cont = 0
        results = []
        for row in re.findall('<div class="torrent">(.*?)</div>', data, re.S):
            size = re.search('size">(.*?)<', row).group(1)
            name = ' - ' + size + ' - ' + re.search("title='(.*?)'", row).group(
                1) + ' - ' + settings.name_provider  #find name in the torrent
            infohash = re.search('http://(.*?)/(.*?)/', row).group(2)
            torrent = 'magnet:?xt=urn:btih:%s' % infohash
            seeds_peers = re.findall('<b>(.*?)<', row)
            seeds = seeds_peers[0]
            peers = seeds_peers[1]
            if filters.verify(name, size):
                results.append({
                    "name": name,
                    "uri": torrent,
                    "info_hash": infohash,
                    "size": common.size_int(size),
                    "seeds": int(seeds),
                    "peers": int(peers),
                    "language": settings.language
                })  # return le torrent
                cont += 1
            else:
                provider.log.warning(filters.reason)
            if cont == settings.max_magnets:  # limit magnets
                break
        provider.log.info('>>>>>>' + str(cont) +
                          ' torrents sent to Pulsar<<<<<<<')
        return results
    except:
        provider.log.error('>>>>>>>ERROR parsing data<<<<<<<')
        provider.notify(message='ERROR parsing data',
                        header=None,
                        time=5000,
                        image=settings.icon)
def extract_torrents(data):
   # try:
        cont = 0
        results = []
        for el in torrent_pattern.finditer(data):
            d = el.groupdict()
            info = common.Magnet(d['magnet'])
            size = d['size'].replace('&nbsp;',' ')
            name = size + 'B' + ' - ' + d['name'] + ' - Rutor'
            provider.log.info('name: ' + name)
            if filters.verify(name.decode('utf-8'), size):
                results.append({"name": name, "uri": d['magnet'], "info_hash": info.hash,
                                     "size": common.size_int(size),
                                     "seeds": int(d['seeds']), "peers": int(d['leech']),
                                     "language": settings.language})  # return le torrent
            cont += 1
            if cont == settings.max_magnets:
                break
        provider.log.info('>>>>>>' + str(cont) + ' torrents sent to Pulsar<<<<<<<')
        return results
   # except:
        provider.log.error('>>>>>>>ERROR parsing data<<<<<<<')