def parse_video(self, response): try: ext_video = [] cluster_id = get_cluster_id(response.request.url) cluster_site = response.xpath( '//ul[@id="supplies"]/li/@site').extract() cluster_site_popup = response.xpath( '//div[@id="supplies-popup"]/div/@site').extract() cluster_site_single = response.xpath( '//div[@id="listing"]/div/div[@class="content"]/@site' ).extract() cluster_src = set(cluster_site + cluster_site_popup + cluster_site_single) for site in cluster_src: url = 'http://www.360kan.com/cover/zongyilist?id=%s&do=switchsite&site=%s' % ( cluster_id, site) downloader = HTTPDownload() content = downloader.get_data(url) json_data = json.loads(content) sel = Selector(text=json_data['data'], type="html") video = sel.xpath('//dl/dt/a/@href').extract() if video: ext_video.append( Util.normalize_url(Util.convert_url(video[0]), channel='variaty')) return ext_video except Exception as e: logging.log(logging.ERROR, traceback.format_exc())
def parse_video(self, response): try: supplies = response.xpath( '//div[@id="listing"]/div/div[@class="content"]/div/div[@class="part"][1]/a[1]/@href' ).extract() return [ Util.normalize_url(Util.convert_url(u), channel='cartoon') for u in supplies ] except Exception as e: logging.log(logging.ERROR, traceback.format_exc())
def parse_video(self, response): try: sup = response.xpath('//ul[@id="supplies"]/li/a/@href').extract() sup_more = response.xpath( '//div[@class="menu"]//ul/li/a/@href').extract() supplies = sup + sup_more return [ Util.normalize_url(Util.convert_url(u), channel='movie') for u in supplies ] except Exception as e: logging.log(logging.ERROR, traceback.format_exc())