| 8 | import base64 |
| 9 | |
| 10 | class Spider(Spider): # 元类 默认的元类 type |
| 11 | def getName(self): |
| 12 | return "央视大全" |
| 13 | def init(self,extend=""): |
| 14 | print("============{0}============".format(extend)) |
| 15 | pass |
| 16 | def isVideoFormat(self,url): |
| 17 | pass |
| 18 | def manualVideoCheck(self): |
| 19 | pass |
| 20 | def homeContent(self,filter): |
| 21 | result = {} |
| 22 | cateManual = { |
| 23 | "央视大全": "CCTV" |
| 24 | } |
| 25 | classes = [] |
| 26 | for k in cateManual: |
| 27 | classes.append({ |
| 28 | 'type_name':k, |
| 29 | 'type_id':cateManual[k] |
| 30 | }) |
| 31 | result['class'] = classes |
| 32 | if(filter): |
| 33 | result['filters'] = self.config['filter'] |
| 34 | return result |
| 35 | def homeVideoContent(self): |
| 36 | result = { |
| 37 | 'list':[] |
| 38 | } |
| 39 | return result |
| 40 | def categoryContent(self,tid,pg,filter,extend): |
| 41 | result = {} |
| 42 | month = "" |
| 43 | year = "" |
| 44 | if 'month' in extend.keys(): |
| 45 | month = extend['month'] |
| 46 | if 'year' in extend.keys(): |
| 47 | year = extend['year'] |
| 48 | if year == '': |
| 49 | month = '' |
| 50 | prefix = year + month |
| 51 | extend['p'] = pg |
| 52 | filterMap = { |
| 53 | "fl":"", |
| 54 | "fc":"", |
| 55 | "cid":"", |
| 56 | "p":"1" |
| 57 | } |
| 58 | suffix = "" |
| 59 | for key in filterMap.keys(): |
| 60 | if key in extend.keys(): |
| 61 | filterMap[key] = extend[key] |
| 62 | suffix = suffix + '&' + key + '=' + filterMap[key] |
| 63 | url = 'https://api.cntv.cn/lanmu/columnSearch?{0}&n=20&serviceId=tvcctv&t=json'.format(suffix) |
| 64 | jo = self.fetch(url,headers=self.header).json() |
| 65 | vodList = jo['response']['docs'] |
| 66 | videos = [] |
| 67 | for vod in vodList: |
nothing calls this directly
no outgoing calls
no test coverage detected