Mutikasa
Power Member
- May 23, 2011
- 589
- 216
This is the PHP implementation of this http://www.blackhatworld.com/blackh...ss-download-upload-txt-file-command-line.html.
PHP:
<?php
error_reporting(-1);
//downloading
$down_urls = $_POST['links'];
$down_urls = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "\n", $down_urls);
$down_urls = explode("\n", $down_urls);
$down_urls = array_filter($down_urls);
if (count($down_urls) > 5)
exit("you have more than 5 videos");
$count = 0;
foreach($down_urls as $down_url) {
$titles[$count] = shell_exec("youtube-dl --get-title $down_url");
$filenames[$count] = shell_exec("youtube-dl --get-filename $down_url");
shell_exec("youtube-dl -o downloads/%\\(id\\)s.%\\(ext\\)s $down_url");
$count++; }
//uploading
$description = $_POST['description'];
$tags = $_POST['tags'];
$email = $_POST['email'];
$password = $_POST['password'];
$category = $_POST['category'];
for($i=0; $i<$count; $i++) {
$youtube_link = shell_exec ("youtube-upload --email=$email --password=$password --title=\"$titles[$i]\" --description=\"$description\" --keywords=\"$tags\" --category=$category --api-upload downloads/$filenames[$i]");
echo "$titles[$i] video uploaded: $youtube_link<br>";
shell_exec("rm downloads/$filenames[$i]");
}
?>