| 9 | from Crypto.Cipher import AES |
| 10 | |
| 11 | class Spider(Spider): # 元类 默认的元类 type |
| 12 | def getName(self): |
| 13 | return "创艺影视" |
| 14 | |
| 15 | def init(self, extend=""): |
| 16 | print("============{0}============".format(extend)) |
| 17 | pass |
| 18 | |
| 19 | def homeContent(self, filter): |
| 20 | result = {} |
| 21 | cateManual = { |
| 22 | "电影": "1", |
| 23 | "剧集": "2", |
| 24 | "动漫": "4", |
| 25 | "综艺": "3", |
| 26 | "纪录片": "30" |
| 27 | } |
| 28 | classes = [] |
| 29 | for k in cateManual: |
| 30 | classes.append({ |
| 31 | 'type_name': k, |
| 32 | 'type_id': cateManual[k] |
| 33 | }) |
| 34 | |
| 35 | result['class'] = classes |
| 36 | if (filter): |
| 37 | result['filters'] = self.config['filter'] |
| 38 | return result |
| 39 | |
| 40 | def homeVideoContent(self): |
| 41 | result = { |
| 42 | 'list': [] |
| 43 | } |
| 44 | return result |
| 45 | |
| 46 | def categoryContent(self, tid, pg, filter, extend): |
| 47 | result = {} |
| 48 | header = {"User-Agent": "Mozilla/5.0 (Linux; Android 4.4.2; Nexus 4 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/34.0.1847.114 Mobile Safari/537.36"} |
| 49 | url = 'https://www.30dian.cn/vodtype/{0}-{1}.html'.format(tid, pg) |
| 50 | rsp = self.fetch(url,headers=header) |
| 51 | root = self.html(self.cleanText(rsp.text)) |
| 52 | aList = root.xpath("//div[@class='myui-panel myui-panel-bg clearfix']/div/div/ul/li") |
| 53 | videos = [] |
| 54 | for a in aList: |
| 55 | name = a.xpath('./div/a/@title')[0] |
| 56 | pic = a.xpath('./div/a/@data-original')[0] |
| 57 | mark = a.xpath("./div/a/span/span[@class='tag']/text()")[0] |
| 58 | sid = a.xpath("./div/a/@href")[0].replace("/", "").replace("voddetail", "").replace(".html", "") |
| 59 | videos.append({ |
| 60 | "vod_id": sid, |
| 61 | "vod_name": name, |
| 62 | "vod_pic": pic, |
| 63 | "vod_remarks": mark |
| 64 | }) |
| 65 | result['list'] = videos |
| 66 | result['page'] = pg |
| 67 | result['pagecount'] = 999 |
| 68 | result['limit'] = 5 |
nothing calls this directly
no outgoing calls
no test coverage detected