forked from Mickeyto/phpVideos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start.php
52 lines (39 loc) · 1.06 KB
/
start.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
<?php
include_once "autoLoad.php";
function checkVersion()
{
if(!function_exists('curl_version')){
die("PHP version\e[31m must enabled curl extension\e[0m\n");
}
$curlVersion = curl_version()['version'];
$phpVersion = version_compare(PHP_VERSION, '7.1.3', '>=');
if(('7.37.0' > $curlVersion) && !$phpVersion){
die("PHP version\e[31m must >= 7.1 and curl version >= 7.37.0\e[0m\n");
}
}
checkVersion();
$argvOpt = \core\Command\Console::initArgv();
if(empty($argvOpt)){
printf("请传入参数 \n");
die;
}
$url = $argvOpt['url'];
$domain = \core\Http\Domain::match($url);
$class = null;
if(empty($domain)){
exit(0);
}
if(in_array($domain, ['91p25', '91porn'])){
$domain = 'Porn';
}
$className = "\core\Platform\\$domain\\" . $domain;
$classFile = __DIR__ . str_replace('\\', DIRECTORY_SEPARATOR, $className);
if(!file_exists($classFile.'.php')){
echo("\033[31m No Support \033[0m".PHP_EOL);
exit(0);
}
/**
* @var $class \core\Common\Downloader
*/
$class = new $className($url);
$class->download($argvOpt);