| 87 | def cleanSpace(self,str): |
| 88 | return str.replace('\n','').replace('\t','').replace('\r','').replace(' ','') |
| 89 | def detailContent(self,array): |
| 90 | aid = array[0] |
| 91 | url = "https://api.bilibili.com/x/web-interface/view?aid={0}".format(aid) |
| 92 | |
| 93 | rsp = self.fetch(url,headers=self.header) |
| 94 | jRoot = json.loads(rsp.text) |
| 95 | jo = jRoot['data'] |
| 96 | title = jo['title'].replace("<em class=\"keyword\">","").replace("</em>","") |
| 97 | pic = jo['pic'] |
| 98 | desc = jo['desc'] |
| 99 | typeName = jo['tname'] |
| 100 | vod = { |
| 101 | "vod_id":aid, |
| 102 | "vod_name":title, |
| 103 | "vod_pic":pic, |
| 104 | "type_name":typeName, |
| 105 | "vod_year":"", |
| 106 | "vod_area":"", |
| 107 | "vod_remarks":"", |
| 108 | "vod_actor":"", |
| 109 | "vod_director":"", |
| 110 | "vod_content":desc |
| 111 | } |
| 112 | ja = jo['pages'] |
| 113 | playUrl = '' |
| 114 | for tmpJo in ja: |
| 115 | cid = tmpJo['cid'] |
| 116 | part = tmpJo['part'] |
| 117 | playUrl = playUrl + '{0}${1}_{2}#'.format(part,aid,cid) |
| 118 | |
| 119 | vod['vod_play_from'] = 'B站' |
| 120 | vod['vod_play_url'] = playUrl |
| 121 | |
| 122 | result = { |
| 123 | 'list':[ |
| 124 | vod |
| 125 | ] |
| 126 | } |
| 127 | return result |
| 128 | def searchContent(self,key,quick): |
| 129 | result = { |
| 130 | 'list':[] |