Esempio n. 1
0
    def search(self, keyword, offset=1):
        print(self.desc)
        results = []

        try:
            doc = self.request(self.rule()['source'].replace(
                'XXX', keyword).replace('YYY', str(offset)))
            groups = doc.xpath(self.rule()['group'])
            for group in groups:
                links = group.xpath(self.rule()['link'])
                for link in links:
                    content = self.request('https://www.yuhuage.xyz'+link)
                    # magnet
                    magnets = [content.xpath(self.rule()['magnet'])[0]]
                    # name
                    names = content.xpath(self.rule()['name'])
                    # size
                    sizes = content.xpath(self.rule()['size'])
                    if len(magnets) == len(names) and len(magnets) == len(sizes):
                        for index in range(0, len(magnets)):
                            results.append({
                                'name': names[index],
                                'size': sizes[index].replace('文件大小:', ''),
                                'magnet': magnets[index],
                                'thunder': to_thunder(magnets[index]),
                                'miwifi': to_miwifi(names[index], magnets[index]),
                            })

        except Exception as e:
            print(self.desc + ' --> ' + str(e))

        return results
Esempio n. 2
0
    def search(self, keyword, offset=1):
        print(self.desc)
        results = []

        try:
            doc = self.request(self.rule()['source'].replace('XXX',
                                                             keyword).replace(
                                                                 'YYY',
                                                                 str(offset)))
            groups = doc.xpath(self.rule()['group'])

            for group in groups:
                # magnet
                magnets = group.xpath(self.rule()['magnet'])
                # name
                names = group.xpath(self.rule()['name'])
                # size
                sizes = group.xpath(self.rule()['size'])

                if len(magnets) == len(names) and len(magnets) == len(sizes):
                    for index in range(0, len(magnets)):
                        results.append({
                            'name':
                            names[index],
                            'size':
                            sizes[index],
                            'magnet':
                            magnets[index],
                            'thunder':
                            to_thunder(magnets[index]),
                            'miwifi':
                            to_miwifi(names[index], magnets[index]),
                        })
        except Exception as e:
            print(self.desc + ' --> ' + e)

        return results
Esempio n. 3
0
from links.mag_link import MagLink
from links.clzz_link import ClzzLink
from links.btdad_link import BtdadLink
from links.clgj_link import ClgjLink
from links.clb_link import ClbLink
from links.clg_link import ClgLink
from links.yhg_link import YhgLink
from tools import to_miwifi, to_thunder

if __name__ == '__main__':
    link = MagLink()
    # link = ClzzLink()
    # link = BtdadLink()
    # link = ClgjLink()
    # link = ClbLink()
    # link = ClgLink()
    # link = YhgLink()
    r = link.search('美女', offset=2)
    print(r)

    obj = r[0]
    name = obj['name']
    url = obj['magnet']
    print(to_miwifi(name, url))
    print(to_thunder(url))