-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathqyl-V1.0.js
314 lines (307 loc) · 9.94 KB
/
qyl-V1.0.js
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
/* by Hhdº */
$ui.render({
props: {
title: "青娱乐"
},
views: [{
type: "list",
props: {
id: "input_list",
data: [{
type: "view",
layout: $layout.fill,
views: [{
type: "button",
props: {
id: "type_button",
type: 1,
icon: $icon("067", $color("#666666"), $size(30, 30))
},
layout(make, view) {
make.left.inset(10)
make.centerY.equalTo(view.super)
},
events: {
tapped(sender) {
$ui.menu({
items: all_type.map(function(item) {
return item.name
}),
handler(title, idx) {
if (idx == 0) {
list.data = JSON.parse($file.read("shared://qyle.txt").string)
$cache.set("fav", 1)
} else refresh(`/${all_type[idx].id}/`)
}
})
}
}
},
{
type: "input",
props: {
type: $kbType.search,
placeholder: "搜索视频...",
clearsOnBeginEditing: true
},
layout(make) {
make.top.bottom.inset(5)
make.right.inset(10)
make.left.equalTo($("type_button").right).offset(10)
},
events: {
returned(sender) {
sender.blur()
refresh(`/search/video/?s=${encodeURI(sender.text)}`)
}
}
}
]
}]
},
layout: function(make) {
make.height.equalTo(50)
make.left.right.top.inset(0)
}
},
{
type: "list",
props: {
id: "video_list",
rowHeight: 400,
data: new Array(),
template: [{
type: "image",
props: {
id: "img",
bgcolor: $color("white"),
radius: 15
},
layout(make) {
make.top.left.right.inset(15)
make.bottom.inset(45)
}
},
{
type: "label",
props: {
id: "name",
textColor: $color("#008062")
},
layout(make, view) {
make.top.equalTo($("img").bottom).offset(10)
make.centerX.equalTo(view.super)
}
},
{
type: "label",
props: {
id: "play_time",
bgcolor: $rgba(0, 0, 0, 0.5),
textColor: $color("white"),
radius: 5,
align: $align.center
},
layout(make) {
make.top.right.inset(25)
make.height.equalTo(35)
make.width.equalTo(120)
}
},
{
type: "label",
props: {
id: "last_time",
bgcolor: $rgba(225, 225, 225, 0.5),
textColor: $color("black"),
radius: 5,
align: $align.center
},
layout(make) {
make.top.left.inset(25)
make.height.equalTo(35)
make.width.equalTo(70)
}
}
],
actions: [{
title: " 收藏❤ ",
handler(sender, indexPath) {
if ($cache.get("fav") == 1) {
sender.delete(indexPath)
var file = sender.data
} else {
var data = sender.data[indexPath.row]
newItem = {
img: {
src: data.img.src
},
name: {
text: data.name.text
},
play_time: {
text: data.play_time.text
},
last_time: {
text: data.last_time.text
},
url: data.url
}
if ($file.exists("shared://qyle.txt") == true) {
var file = JSON.parse($file.read("shared://qyle.txt").string)
file.unshift(newItem)
} else var file = [newItem]
$ui.toast("已收藏")
}
$file.write({
path: "shared://qyle.txt",
data: $data({
string: JSON.stringify(file)
})
})
}
},
{
title: " 菜单🔘 ",
handler(sender, indexPath) {
var data = sender.data[indexPath.row]
web_url = website + encodeURI(data.url)
$ui.menu({
items: ["在Safari打开网页", "在Safari播放视频", "新窗口播放视频", "新窗口打开网页", "复制网页链接", "复制视频直链", "下载视频至本地"],
handler(title, idx) {
switch (idx) {
case 0:
$app.openBrowser({ url: web_url })
break
case 3:
openURL(web_url)
break
case 4:
$clipboard.text = web_url
break
default:
play(idx, data.url, indexPath, data.img.src)
break
}
}
})
}
}
]
},
layout(make) {
make.top.equalTo($("input_list").bottom)
make.left.right.bottom.inset(0)
},
events: {
didSelect(sender, indexPath, data) {
play(0, data.url, indexPath, data.img.src)
}
}
}
]
})
function refresh(id) {
$http.get({
url: website + id,
header: {
'User-Agent': ua
},
handler(resp) {
$cache.remove("fav")
var data = resp.data.replace(/\n|\s|\r/g, "")
rowInfo = data.match(/<ahref=\"\/\d+\/.*?\/\"title=\".*?\"class=\"thumbnail\"target=\"_blank\"><divclass=\"video-thumb\"><imgsrc=\"http:\/\/www.qyl099.com\/media\/videos\/tmb\/\d+\/\d+\/\d+\/\d*\.jpg"/g)
playTime = data.match(/\d+次播放(?=<\/span>)/g)
lastTime = data.match(/\d+:\d+(?=<\/span>)/g)
arr = []
for (i in rowInfo) {
var item = rowInfo[i]
arr.push({
img: {
src: item.match(/http:\/\/www.qyl099.com\/media\/videos\/tmb\/\d+\/\d+\/\d+\/\d*\.jpg/)[0]
},
name: {
text: item.match(/title=\".*?(?=\")/)[0].replace("title=\"", "")
},
play_time: {
text: playTime[i]
},
last_time: {
text: lastTime[i]
},
url: item.match(/\/\d+\/.*?\/(?=\"title)/)[0]
})
}
list.data = arr
}
})
}
function play(num, url, idx, img_url) {
var web_url = website + encodeURI(url)
$http.get({
url: web_url,
header: {
'User-Agent': ua
},
handler(resp) {
var file_url = resp.data.match(/http:.*?\.mp4/)[0]
switch (num) {
case 0:
list.cell(idx).add({
type: "video",
props: {
src: file_url,
poster: img_url,
radius: 15
},
layout(make) {
make.top.left.right.inset(15)
make.bottom.inset(45)
}
})
break
case 1:
$app.openBrowser({ url: file_url })
break
case 2:
openURL(file_url)
break
case 5:
$clipboard.text = file_url
break
case 6:
download(file_url)
break
}
}
})
}
function openURL(url) {
$ui.push({
props: {
title: url
},
views: [{
type: "web",
props: {
url: url
},
layout: $layout.fill
}]
})
}
function download(url) {
$ui.loading(true)
$http.download({
url: url,
handler(resp) {
$ui.loading(false)
$share.sheet(resp.data)
}
})
}
const ua = "Mozilla/5.0 (iPad; CPU OS 10_3_2 like Mac OS X) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.0 Mobile/14F89 Safari/602.1"
list = $("video_list")
website = "http://www.qyl099.com"
all_type = [{ "name": "我的收藏❤" }, { "name": "成人动漫", "id": "cartoon" }, { "name": "长视频", "id": "changshipin" }, { "name": "潮喷", "id": "chaopen" }, { "name": "大屌", "id": "dadiao" }, { "name": "肛交", "id": "gangjiao" }, { "name": "高清HD", "id": "gaoqing" }, { "name": "男同性恋", "id": "gay" }, { "name": "国产自拍", "id": "guochan" }, { "name": "巨乳波霸", "id": "juru" }, { "name": "口爆颜射", "id": "koubaoyanshe" }, { "name": "性感美女", "id": "meinv" }, { "name": "嫩妹", "id": "nenmei" }, { "name": "女同性恋", "id": "nvtong" }, { "name": "欧美性爱", "id": "oumei" }, { "name": "日韩情色", "id": "party" }, { "name": "公众户外", "id": "public" }, { "name": "自慰器具", "id": "qijuziwei" }, { "name": "集体群交", "id": "qunjiao" }, { "name": "强奸", "id": "rapping" }, { "name": "熟女人妻", "id": "renqishunv" }, { "name": "青娱乐美女热舞", "id": "rewu" }, { "name": "日本无码", "id": "ribenwuma" }, { "name": "性爱", "id": "sex" }, { "name": "丝袜美腿", "id": "siwa" }, { "name": "SM调教", "id": "smxingnue" }, { "name": "素人", "id": "suren" }, { "name": "偷情乱伦", "id": "touqingyuluanlun" }, { "name": "短视频", "id": "xiaobian" }, { "name": "校园激情", "id": "xiaoyuan" }, { "name": "亚洲性爱", "id": "yazhou" }, { "name": "日本有码", "id": "youma" }, { "name": "制服诱惑", "id": "zhifu" }, { "name": "重口味", "id": "zhongkouwei" }, { "name": "中文字幕", "id": "zhongwenzimu" }, { "name": "网络主播", "id": "zhubo" }, { "name": "足交", "id": "zujiao" }]
refresh("")