| 6 | import json |
| 7 | |
| 8 | class Spider(Spider): # 元类 默认的元类 type |
| 9 | def getName(self): |
| 10 | return "我爱跟剧" |
| 11 | def init(self,extend=""): |
| 12 | print("============{0}============".format(extend)) |
| 13 | pass |
| 14 | def isVideoFormat(self,url): |
| 15 | pass |
| 16 | def manualVideoCheck(self): |
| 17 | pass |
| 18 | def homeContent(self,filter): |
| 19 | # genmov |
| 20 | # https://www.genmov.com/v/yinyue.html |
| 21 | result = {} |
| 22 | cateManual = { |
| 23 | "电影":"dianying", |
| 24 | "连续剧":"lianxuju", |
| 25 | "动漫":"dongman", |
| 26 | "综艺":"zongyi", |
| 27 | "少儿":"shaoer", |
| 28 | "音乐":"yinyue" |
| 29 | } |
| 30 | classes = [] |
| 31 | for k in cateManual: |
| 32 | classes.append({ |
| 33 | 'type_name':k, |
| 34 | 'type_id':cateManual[k] |
| 35 | }) |
| 36 | result['class'] = classes |
| 37 | if(filter): |
| 38 | result['filters'] = self.config['filter'] |
| 39 | return result |
| 40 | def homeVideoContent(self): |
| 41 | rsp = self.fetch("https://www.genmov.com/",headers=self.header) |
| 42 | root = self.html(rsp.text) |
| 43 | aList = root.xpath("//div[@class='module module-wrapper']//div[@class='module-item']") |
| 44 | videos = [] |
| 45 | for a in aList: |
| 46 | name = a.xpath(".//div[@class='module-item-pic']/a/@title")[0] |
| 47 | pic = a.xpath(".//div[@class='module-item-pic']/img/@data-src")[0] |
| 48 | mark = a.xpath("./div[@class='module-item-text']/text()")[0] |
| 49 | sid = a.xpath(".//div[@class='module-item-pic']/a/@href")[0] |
| 50 | sid = self.regStr(sid,"/video/(\\S+).html") |
| 51 | videos.append({ |
| 52 | "vod_id":sid, |
| 53 | "vod_name":name, |
| 54 | "vod_pic":pic, |
| 55 | "vod_remarks":mark |
| 56 | }) |
| 57 | result = { |
| 58 | 'list':videos |
| 59 | } |
| 60 | return result |
| 61 | def categoryContent(self,tid,pg,filter,extend): |
| 62 | result = {} |
| 63 | urlParams = ["", "", "", "", "", "", "", "", "", "", "", ""] |
| 64 | urlParams[0] = tid |
| 65 | urlParams[8] = pg |
nothing calls this directly
no outgoing calls
no test coverage detected