MCPcopy Create free account
hub / github.com/UndCover/PyramidStore / searchContent

Method searchContent

plugin/py_bilimd.py:135–164  ·  view source on GitHub ↗
(self,key,quick)

Source from the content-addressed store, hash-verified

133 }
134 return result
135 def searchContent(self,key,quick):
136 url = 'https://api.bilibili.com/x/web-interface/search/type?search_type=media_bangumi&keyword={0}'.format(key) # 番剧搜索
137 if len(self.cookies) <= 0:
138 self.getCookie()
139 rsp = self.fetch(url, cookies=self.cookies)
140 content = rsp.text
141 jo = json.loads(content)
142 rs = jo['data']
143 if rs['numResults'] == 0:
144 url = 'https://api.bilibili.com/x/web-interface/search/type?search_type=media_ft&keyword={0}'.format(key) # 影视搜索
145 rspRetry = self.fetch(url, cookies=self.cookies)
146 content = rspRetry.text
147 jo = json.loads(content)
148 videos = []
149 vodList = jo['data']['result']
150 for vod in vodList:
151 aid = str(vod['season_id']).strip()
152 title = vod['title'].strip().replace("<em class=\"keyword\">", "").replace("</em>", "")
153 img = vod['eps'][0]['cover'].strip()
154 remark = vod['index_show']
155 videos.append({
156 "vod_id": aid,
157 "vod_name": title,
158 "vod_pic": img,
159 "vod_remarks": remark
160 })
161 result = {
162 'list': videos
163 }
164 return result
165
166 def playerContent(self,flag,id,vipFlags):
167 result = {}

Callers

nothing calls this directly

Calls 2

getCookieMethod · 0.95
fetchMethod · 0.95

Tested by

no test coverage detected