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

Class Spider

plugin/py_huya.py:8–140  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6import json
7
8class Spider(Spider):
9 def getName(self):
10 return "虎牙"
11 def init(self,extend=""):
12 pass
13 def isVideoFormat(self,url):
14 pass
15 def manualVideoCheck(self):
16 pass
17 def homeContent(self,filter):
18 result = {}
19 cateManual = {
20 "音乐": "音乐",
21 "一起看": "一起看",
22 "三国杀": "三国杀",
23 "网游竞技": "网游竞技"
24 }
25 classes = []
26 for k in cateManual:
27 classes.append({
28 'type_name': k,
29 'type_id': cateManual[k]
30 })
31
32 result['class'] = classes
33 if (filter):
34 result['filters'] = self.config['filter']
35 return result
36 def homeVideoContent(self):
37 result = {}
38 return result
39 def categoryContent(self,tid,pg,filter,extend):
40 result = {}
41 url = 'http://live.yj1211.work/api/live/getRecommendByPlatformArea?platform=huya&size=20&area={0}&page={1}'.format(tid, pg)
42 rsp = self.fetch(url)
43 content = rsp.text
44 jo = json.loads(content)
45 videos = []
46 vodList = jo['data']
47 for vod in vodList:
48 aid = (vod['roomId']).strip()
49 title = vod['roomName'].strip()
50 img = vod['roomPic'].strip()
51 remark = (vod['ownerName']).strip()
52 videos.append({
53 "vod_id": aid,
54 "vod_name": title,
55 "vod_pic": img,
56 "vod_remarks": remark
57 })
58 result['list'] = videos
59 result['page'] = pg
60 result['pagecount'] = 9999
61 result['limit'] = 90
62 result['total'] = 999999
63 return result
64 def detailContent(self,array):
65 aid = array[0]

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected