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

Class Spider

plugin/py_cctv.py:10–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8import base64
9
10class Spider(Spider): # 元类 默认的元类 type
11 def getName(self):
12 return "央视"
13 def init(self,extend=""):
14 print("============{0}============".format(extend))
15 pass
16 def isVideoFormat(self,url):
17 pass
18 def manualVideoCheck(self):
19 pass
20 def homeContent(self,filter):
21 result = {}
22 cateManual = {
23 "等着我": "TOPC1451378757637200",
24 "我爱发明": "TOPC1569314345479107",
25 "动物世界": "TOPC1451378967257534",
26 "探索发现": "TOPC1451557893544236",
27 "创新进行时": "TOPC1570875218228998",
28 "我爱发明2021": "TOPC1451557970755294",
29 "经典咏流传 第五季":"VIDAIiNbDQzOjE5mLl3T4t2B220403"
30 }
31 classes = []
32 for k in cateManual:
33 classes.append({
34 'type_name':k,
35 'type_id':cateManual[k]
36 })
37 result['class'] = classes
38 if(filter):
39 result['filters'] = self.config['filter']
40 return result
41 def homeVideoContent(self):
42 result = {
43 'list':[]
44 }
45 return result
46 def categoryContent(self,tid,pg,filter,extend):
47 result = {}
48 extend['id'] = tid
49 extend['p'] = pg
50 filterParams = ["id", "p", "d"]
51 params = ["", "", ""]
52 for idx in range(len(filterParams)):
53 fp = filterParams[idx]
54 if fp in extend.keys():
55 params[idx] = '{0}={1}'.format(filterParams[idx],extend[fp])
56 suffix = '&'.join(params)
57 url = 'https://api.cntv.cn/NewVideo/getVideoListByColumn?{0}&n=20&sort=desc&mode=0&serviceId=tvcctv&t=json'.format(suffix)
58 if not tid.startswith('TOPC'):
59 url = 'https://api.cntv.cn/NewVideo/getVideoListByAlbumIdNew?{0}&n=20&sort=desc&mode=0&serviceId=tvcctv&t=json'.format(suffix)
60 rsp = self.fetch(url,headers=self.header)
61 jo = json.loads(rsp.text)
62 vodList = jo['data']['list']
63 videos = []
64 for vod in vodList:
65 guid = vod['guid']
66 title = vod['title']
67 img = vod['image']

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected