| 109 | return str.replace('\n', '').replace('\t', '').replace('\r', '').replace(' ', '') |
| 110 | |
| 111 | def detailContent(self, array): |
| 112 | aid = array[0] |
| 113 | url = "https://api.bilibili.com/x/web-interface/view?aid={0}".format(aid) |
| 114 | rsp = self.fetch(url, headers=self.header) |
| 115 | jRoot = json.loads(rsp.text) |
| 116 | jo = jRoot['data'] |
| 117 | title = jo['title'].replace("<em class=\"keyword\">", "").replace("</em>", "") |
| 118 | pic = jo['pic'] |
| 119 | desc = jo['desc'] |
| 120 | timeStamp = jo['pubdate'] |
| 121 | timeArray = time.localtime(timeStamp) |
| 122 | year = str(time.strftime("%Y", timeArray)) |
| 123 | dire = jo['owner']['name'] |
| 124 | typeName = jo['tname'] |
| 125 | remark = str(jo['duration']).strip() |
| 126 | vod = { |
| 127 | "vod_id": aid, |
| 128 | "vod_name": title, |
| 129 | "vod_pic": pic, |
| 130 | "type_name": typeName, |
| 131 | "vod_year": year, |
| 132 | "vod_area": "", |
| 133 | "vod_remarks": remark, |
| 134 | "vod_actor": "", |
| 135 | "vod_director": dire, |
| 136 | "vod_content": desc |
| 137 | } |
| 138 | ja = jo['pages'] |
| 139 | playUrl = '' |
| 140 | for tmpJo in ja: |
| 141 | cid = tmpJo['cid'] |
| 142 | part = tmpJo['part'].replace("#", "-") |
| 143 | playUrl = playUrl + '{0}${1}_{2}#'.format(part, aid, cid) |
| 144 | |
| 145 | vod['vod_play_from'] = 'B站视频' |
| 146 | vod['vod_play_url'] = playUrl |
| 147 | |
| 148 | result = { |
| 149 | 'list': [ |
| 150 | vod |
| 151 | ] |
| 152 | } |
| 153 | return result |
| 154 | |
| 155 | def searchContent(self, key, quick): |
| 156 | header = { |