#coding=utf-8 #!/usr/bin/python import sys sys.path.append('..') from base.spider import Spider import json import time import base64 import re from urllib import request, parse import urllib import urllib.request import time class Spider(Spider): # 元类 默认的元类 type def getName(self): return "樱花动漫6"#6才是本体 def init(self,extend=""): print("============{0}============".format(extend)) pass def isVideoFormat(self,url): pass def manualVideoCheck(self): pass def homeContent(self,filter): result = {} cateManual = { "日本动漫":"1", "国产动漫":"4", "动漫电影":"2", "欧美动漫":"3" } classes = [] for k in cateManual: classes.append({ 'type_name':k, 'type_id':cateManual[k] }) result['class'] = classes if(filter): result['filters'] = self.config['filter'] return result def homeVideoContent(self): htmlTxt=self.custom_webReadFile(urlStr='https://yhdm6.top/') videos = self.custom_list(html=htmlTxt,patternTxt=r'(?P.+?)') result = { 'list':videos } return result def categoryContent(self,tid,pg,filter,extend): result = {} videos=[] types="" if 'types' in extend.keys(): if extend['types'].find('全部')<0: types='class/{0}/'.format(urllib.parse.quote(extend['types'])) letter='' if 'letter' in extend.keys(): if extend['letter'].find('全部')<0: letter='letter/{0}/'.format(extend['letter']) year='' if 'year' in extend.keys(): if extend['year'].find('全部')<0: year='/year/{0}'.format(extend['year']) by='' if 'by' in extend.keys(): by='by/{0}/'.format(extend['by']) Url='https://yhdm6.top/index.php/vod/show/{2}{3}id/{0}/{5}{1}{4}.html'.format(tid,'page/'+pg,by,types,year,letter) # print(url) #https://yhdm6.top/index.php/vod/show/by/score/class/%E7%A7%91%E5%B9%BB/id/3/letter/W/year/2022.html htmlTxt=self.custom_webReadFile(urlStr=Url) videos = self.custom_list(html=htmlTxt,patternTxt=r'(?P.+?)') result['list'] = videos result['page'] = pg result['pagecount'] = pg if len(videos)<60 else int(pg)+1 result['limit'] = 90 result['total'] = 999999 return result def detailContent(self,array): aid = array[0].split('###') idUrl=aid[1] title=aid[0] pic=aid[2] url=idUrl htmlTxt = self.custom_webReadFile(urlStr=url,codeName='utf-8') line=self.custom_RegexGetTextLine(Text=htmlTxt,RegexText=r'',Index=1) if len(line)<1: return {'list': []} playFrom = [] videoList=[] vodItems = [] circuit=self.custom_lineList(Txt=htmlTxt,mark=r'