-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.php
85 lines (73 loc) · 2.49 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
84
85
<?php
/*
James William Fletcher (github.com/mrbid)
December 2021
Grabber url setup mechanism
Part of the YoutubeIPGrabber; https://github.com/mrbid/Youtube-IP-Grabber
*/
$ip = urlencode($_SERVER['REMOTE_ADDR']);
$ua = '';
if(isset($_SERVER['HTTP_USER_AGENT']))
$ua = $_SERVER['HTTP_USER_AGENT'];
$xff = 'DIRECT';
if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
$xff = $_SERVER['HTTP_X_FORWARDED_FOR'];
if($xff == 'DIRECT')
file_put_contents("accessdirect.txt", date("Y-m-d H:i:s: ") . $ip . ", " . $xff . ", " . $ua . "\n", FILE_APPEND | LOCK_EX);
else
file_put_contents("access.txt", date("Y-m-d H:i:s: ") . $ip . ", " . $xff . ", " . $ua . "\n", FILE_APPEND | LOCK_EX);
if(!isset($_GET['v']))
{
header("Location: https://youtube.com");
exit;
}
function recurse_copy($src, $dst)
{
// https://www.php.net/manual/de/function.copy.php#91010
$dir = opendir($src);
@mkdir($dst);
while(false !== ( $file = readdir($dir)) ) {
if (( $file != '.' ) && ( $file != '..' )) {
if ( is_dir($src . '/' . $file) ) {
recurse_copy($src . '/' . $file,$dst . '/' . $file);
}
else {
copy($src . '/' . $file,$dst . '/' . $file);
chmod($dst . '/' . $file, 0777);
}
}
}
closedir($dir);
}
if(isset($_GET['v']))
{
$name = $_GET['v'];
if(!file_exists($name))
{
recurse_copy('ec450278fd50abd97850a14c19bee9c0', $name);
}
else
{
header('Location: ' . $name);
exit;
}
$info = $_GET['v'] . "\n";
$d = file_get_contents("https://www.youtube.com/watch?v=".urlencode($_GET['v']));
$s = strstr($d, "<title>");
$s = substr($s, 7);
$s = explode(' - ', $s, 2)[0];
$info .= $s . "\n";
$s = strstr($d, '<meta property="og:description" content="');
$s = substr($s, 41);
$s = explode('"', $s, 2)[0];
$info .= $s . "\n";
$s = strstr($d, '<meta property="og:image" content="');
$s = substr($s, 35);
$s = explode('"', $s, 2)[0];
$info .= $s . "\n";
file_put_contents($name . "/info.txt", $info, FILE_APPEND | LOCK_EX);
file_put_contents($name . "/creator.txt", date("Y-m-d H:i:s: ") . $ip . ", " . $xff . ", " . $ua . "\n", FILE_APPEND | LOCK_EX);
file_put_contents("master/creators.txt", date("Y-m-d H:i:s: ") . $ip . ", " . $xff . ", " . $ua . "\n", FILE_APPEND | LOCK_EX);
echo "https://" . $_SERVER['HTTP_HOST'] . "/" . $name;
}
?>