| 5 | from base.spider import Spider |
| 6 | |
| 7 | class Spider(Spider): |
| 8 | def getDependence(self): |
| 9 | return ['py_ali'] |
| 10 | def getName(self): |
| 11 | return "py_pansou" |
| 12 | def init(self,extend): |
| 13 | self.ali = extend[0] |
| 14 | print("============py_pansou============") |
| 15 | pass |
| 16 | def isVideoFormat(self,url): |
| 17 | pass |
| 18 | def manualVideoCheck(self): |
| 19 | pass |
| 20 | def homeContent(self,filter): |
| 21 | result = {} |
| 22 | return result |
| 23 | def homeVideoContent(self): |
| 24 | result = {} |
| 25 | return result |
| 26 | def categoryContent(self,tid,pg,filter,extend): |
| 27 | result = {} |
| 28 | return result |
| 29 | |
| 30 | def detailContent(self,array): |
| 31 | tid = array[0] |
| 32 | print(self.getName()) |
| 33 | pattern = '(https:\\/\\/www.aliyundrive.com\\/s\\/[^\\\"]+)' |
| 34 | url = self.regStr(tid,pattern) |
| 35 | if len(url) > 0: |
| 36 | return self.ali.detailContent(array) |
| 37 | |
| 38 | rsp = self.fetch('https://www.alipansou.com'+tid) |
| 39 | url = self.regStr(rsp.text,pattern) |
| 40 | if len(url) == 0: |
| 41 | return "" |
| 42 | url = url.replace('\\','') |
| 43 | newArray = [url] |
| 44 | print(newArray) |
| 45 | return self.ali.detailContent(newArray) |
| 46 | |
| 47 | |
| 48 | def searchContent(self,key,quick): |
| 49 | map = { |
| 50 | '7':'文件夹', |
| 51 | '1':'视频' |
| 52 | } |
| 53 | ja = [] |
| 54 | for tKey in map.keys(): |
| 55 | url = "https://www.alipansou.com/search?k={0}&t={1}".format(key,tKey) |
| 56 | rsp = self.fetch(url) |
| 57 | root = self.html(self.cleanText(rsp.text)) |
| 58 | aList = root.xpath("//van-row/a") |
| 59 | for a in aList: |
| 60 | title = '' |
| 61 | # title = a.xpath('string(.//template/div)') |
| 62 | # title = self.cleanText(title).strip() |
| 63 | |
| 64 | divList = a.xpath('.//template/div') |
nothing calls this directly
no outgoing calls
no test coverage detected