-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathindex.php
63 lines (53 loc) · 1.59 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
<?php
require_once('simpleHtmlDom.php');
require_once('Youtube-Downloader/YTDL.php');
require_once('YTPDL.php');
ignore_user_abort(true);
set_time_limit(0);
if(isset($_POST['submit'])){
$email = filter_var($_POST['mail'], FILTER_SANITIZE_EMAIL);
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
die('Invalid mail!');
}
$pName = htmlspecialchars($_POST['name']);
if (mb_strlen($pName) > 30) {
die('Playlist name is too long!');
}
if (preg_match('/[a-z0-9_-]{11,40}/i', $_POST['PID'], $matches)) {
downloadListVideos($matches[0], $pName, $email);
}
else{
die('Playlist ID not found!');
}
}
else{
echo <<<HTML
<html>
<head>
<meta charset="utf-8">
<meta name="author" content="Yehuda Eisenberg">
<title>PHP Youtube Playlist Downloader</title>
</head>
<body align="center">
<div id="content">
<form method="post">
<h1>PHP Youtube Playlist Downloader</h1>
<h2><a href="https://github.com/YehudaEi/Youtube-Playlist-Downloader">Fork in GitHub</a></h2>
<h2>based on <a href="https://github.com/YehudaEi/Youtube-Downloader">YehudaEi/Youtube-Downloader</a> Lib</h2>
<br>
<input type="text" style="width:180" placeholder="Playlist ID (only id)" name="PID">
<br>
<br>
<input type="text" style="width:180" placeholder="Playlist name" name="name">
<br>
<br>
<input type="text" style="width:180" placeholder="Your mail" name="mail">
<br>
<br>
<input type="submit" value="הורד" name="submit">
</form>
</div>
</body>
</html>
HTML;
}