-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
83 lines (81 loc) · 2.82 KB
/
index.php
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
<?php
/* File Info
* Author: AiMuC
* CreateTime: 2021/2/12 下午2:16:07
* LastEditor: AiMuC
* ModifyTime: 2021/2/26 下午4:17:28
* Description:
*/
require('system/init.php');
switch ($_GET['type']) {
case "getfjurl":
$Url = GetFjUrl($_GET['id']);
if (!empty($Url)) {
echo ResponseData('番剧播放地址获取成功', 'success', $Url);
} else {
echo ResponseData('番剧播放地址获取失败-可能的原因为账号非大会员或cookie设置错误', 'error');
}
break;
case "geturl":
$Url = GetVideoSrc($_GET['id']);
if (!empty($Url)) {
echo ResponseData('视频地址获取成功', 'success', $Url);
} else {
echo ResponseData('视频地址获取失败', 'error');
}
break;
case "download":
DownloadVideo($_GET['id']);
break;
default:
break;
}
/*
如使用腾讯云函数部署该项目请将以上 switch case内容注释
腾讯云函数内需定义入口函数为 index.main_handler
*/
function main_handler($event, $context)
{
$ID = json_encode($event->queryString->id, JSON_UNESCAPED_UNICODE);
$ID = str_replace('"', "", $ID);
switch ($event->queryString->type) {
case "geturl":
$VideoSrc = GetVideoSrc($ID);
if (!empty($VideoSrc)) {
return array(
'isBase64Encoded' => false,
'statusCode' => 200,
'headers' => array('Content-Type' => 'text/html; charset=utf-8'),
'body' => ResponseData('视频地址获取成功', 'success', $VideoSrc)
);
} else {
return array(
'isBase64Encoded' => false,
'statusCode' => 200,
'headers' => array('Content-Type' => 'text/html; charset=utf-8'),
'body' => ResponseData('视频地址获取失败', 'error')
);
}
break;
case "getfjurl":
$VideoSrc = GetFjUrl($ID);
if (!empty($VideoSrc)) {
return array(
'isBase64Encoded' => false,
'statusCode' => 200,
'headers' => array('Content-Type' => 'text/html; charset=utf-8'),
'body' => ResponseData('番剧播放地址获取成功', 'success', $VideoSrc)
);
} else {
return array(
'isBase64Encoded' => false,
'statusCode' => 200,
'headers' => array('Content-Type' => 'text/html; charset=utf-8'),
'body' => ResponseData('番剧播放地址获取失败', 'error')
);
}
break;
default:
break;
}
}