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
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: f_url = 'https://www.fshare.vn/api/v3/files/folder?linkcode=%s' % FShareVN.extract_code(link.get('href')) if link and 'fshare' in link.get('href'): links.append(f_url) if len(links) > 0: results = AsyncRequest().get(links) for idx, result in enumerate(results): try: link = items[idx].get('href') name, size = FShareVN.get_asset_info(content=result) movie['links'].append({ 'link': link, 'title': '[%s] %s' % (size, name), 'type': 'Fshare', 'isFolder': FShareVN.is_folder(link), 'subtitle': subtitle, 'resolve': False }) except: print('Link die %s' % items[idx].get('href')) continue return movie