forked from heroaku/TVboxo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpy_jrskbs.py
166 lines (157 loc) · 4.16 KB
/
py_jrskbs.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
#coding=utf-8
#!/usr/bin/python
import sys
sys.path.append('..')
from base.spider import Spider
import re
import math
class Spider(Spider):
def getName(self):
return "体育直播"
def init(self,extend=""):
pass
def isVideoFormat(self,url):
pass
def manualVideoCheck(self):
pass
def homeContent(self,filter):
result = {}
cateManual = {
"全部": ""
}
classes = []
for k in cateManual:
classes.append({
'type_name': k,
'type_id': cateManual[k]
})
result['class'] = classes
if (filter):
result['filters'] = self.config['filter']
return result
def homeVideoContent(self):
result = {}
return result
def categoryContent(self,tid,pg,filter,extend):
result = {}
url = 'https://m.jrskbs.com'
rsp = self.fetch(url)
html = self.html(rsp.text)
aList = html.xpath("//div[contains(@class, 'contentList')]/a")
videos = []
numvL = len(aList)
pgc = math.ceil(numvL/15)
for a in aList:
aid = a.xpath("./@href")[0]
aid = self.regStr(reg=r'/live/(.*?).html', src=aid)
img = a.xpath(".//div[@class='contentLeft']/p/img/@src")[0]
home = a.xpath(".//div[@class='contentLeft']/p[@class='false false']/text()")[0]
away = a.xpath(".//div[@class='contentRight']/p[@class='false false']/text()")[0]
infoArray = a.xpath(".//div[@class='contentCenter']/p")
remark = ''
for info in infoArray:
content = info.xpath('string(.)').replace(' ','')
remark = remark + '|' + content
videos.append({
"vod_id": aid,
"vod_name": home + 'vs' + away,
"vod_pic": img,
"vod_remarks": remark.strip('|')
})
result['list'] = videos
result['page'] = pg
result['pagecount'] = pgc
result['limit'] = numvL
result['total'] = numvL
return result
def detailContent(self,array):
aid = array[0]
url = "http://m.jrskbs.com/live/{0}.html".format(aid)
rsp = self.fetch(url)
root = self.html(rsp.text)
divContent = root.xpath("//div[@class='today']")[0]
home = divContent.xpath(".//p[@class='onePlayer homeTeam']/text()")[0]
away = divContent.xpath(".//div[3]/text()")[0].strip()
title = home + 'vs' + away
pic = divContent.xpath(".//img[@class='gameLogo1 homeTeam_img']/@src")[0]
typeName = divContent.xpath(".//div/p[@class='name1 matchTime_wap']/text()")[0]
remark = divContent.xpath(".//div/p[@class='time1 matchTitle']/text()")[0].replace(' ','')
vod = {
"vod_id": aid,
"vod_name": title,
"vod_pic": pic,
"type_name": typeName,
"vod_year": "",
"vod_area": "",
"vod_remarks": remark,
"vod_actor": '',
"vod_director":'',
"vod_content": ''
}
urlList = root.xpath("//div[@class='liveshow']/a")
playUrl = ''
for url in urlList:
name = url.xpath("./text()")[0]
purl = url.xpath("./@data-url")[0]
playUrl =playUrl + '{0}${1}#'.format(name, purl)
vod['vod_play_from'] = '体育直播'
vod['vod_play_url'] = playUrl
result = {
'list': [
vod
]
}
return result
def searchContent(self,key,quick):
result = {}
return result
def playerContent(self,flag,id,vipFlags):
result = {}
url = id
if '04stream' in url:
rsp = self.fetch(url)
html = rsp.text
strList = re.findall(r"eval\((.*?)\);", html)
fuctList = strList[1].split('+')
scrpit = ''
for fuc in fuctList:
if fuc.endswith(')'):
append = fuc.split(')')[-1]
else:
append = ''
Unicode = int(self.regStr(reg=r'l\((.*?)\)', src=fuc))
char = chr(Unicode % 256)
char = char + append
scrpit = scrpit + char
par = self.regStr(reg=r'/(.*)/', src=scrpit).replace(')', '')
pars = par.split('/')
infoList = strList[2].split('+')
str = ''
for info in infoList:
if info.startswith('O'):
Unicode = int(int(self.regStr(reg=r'O\((.*?)\)', src=info)) / int(pars[0]) / int(pars[1]))
char = chr(Unicode % 256)
str = str + char
url = self.regStr(reg=r"play_url=\'(.*?)\'", src=str)
result["parse"] = 0
else:
url = id
result["parse"] = 1
result["playUrl"] = ''
result["url"] = url
result["header"] = ''
return result
config = {
"player": {},
"filter": {}
}
header = {}
def localProxy(self,param):
action = {
'url':'',
'header':'',
'param':'',
'type':'string',
'after':''
}
return [200, "video/MP2T", action, ""]