コード例 #1
0
    def get(self, response, origin_url=""):
        self.found_links = []
        movie = {
            'group': {},
            'episode': [],
            'links': [],
        }
        soup = BeautifulSoup(response, "html.parser")
        posts = soup.select(
            "ol.messageList > li.message > div.messageInfo > div.messageContent > article > blockquote"
        )
        for post in posts:
            self.extract_links(post)

        if len(self.found_links) > 0:
            arequest = AsyncRequest()
            results = arequest.get(self.found_links)
            for idx, result in enumerate(results):
                try:
                    name, size = FShareVN.get_info(content=result)
                except:
                    print('Link die %s' % self.found_links[idx])
                    continue

                if name:
                    movie['links'].append({
                        'link':
                        self.found_links[idx],
                        'title':
                        '[%s] %s' % (size, name),
                        'intro':
                        name,
                        'type':
                        'Unknown',
                        'resolve':
                        False,
                        'isFolder':
                        FShareVN.is_folder(self.found_links[idx]),
                        'originUrl':
                        origin_url
                    })
                else:
                    movie['links'].append({
                        'link':
                        self.found_links[idx],
                        'title':
                        self.found_links[idx],
                        'type':
                        'Unknown',
                        'resolve':
                        False,
                        'isFolder':
                        FShareVN.is_folder(self.found_links[idx]),
                        'originUrl':
                        origin_url
                    })

        return movie
コード例 #2
0
ファイル: movie.py プロジェクト: chiennv97/bimozie
    def get(self, response, skipEps=False):
        movie = {
            'group': {},
            'episode': [],
            'links': [],
        }
        soup = BeautifulSoup(response, "html.parser")
        # get all server list
        servers = soup.select("ul.ipsDataList > div#extraFields > li")

        # get subtitle link
        subtitle = None
        try:
            subtitle = soup.select_one(
                "ul.ipsDataList > div#extraFields > li a.ipsType_success").get(
                    'href')
        except:
            pass

        server = servers[-1:][0]
        items = server.select('> span.ipsDataItem_main a')

        links = []
        for link in items:
            if link and 'fshare' in link.get('href'):
                links.append(link.get('href'))

        if len(links) > 0:
            results = AsyncRequest().get(links)
            for idx, result in enumerate(results):
                try:
                    name, size = FShareVN.get_info(content=result)
                    movie['links'].append({
                        'link': links[idx],
                        'title': '[%s] %s' % (size, name),
                        'type': 'Unknown',
                        'subtitle': subtitle,
                        'resolve': False
                    })
                except:
                    print('Link die %s' % links[idx])
                    continue

        return movie