2021-03-18 23:04:04 +01:00
|
|
|
<?php
|
2021-03-23 12:13:23 +01:00
|
|
|
include( '_head.php' );
|
2021-03-23 12:54:17 +01:00
|
|
|
?>
|
|
|
|
<div class="container">
|
2021-03-23 12:13:23 +01:00
|
|
|
|
2021-03-23 12:54:17 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* récupération d'une vidéo par youtube dl et conversion
|
|
|
|
*/
|
2021-03-23 12:13:23 +01:00
|
|
|
|
|
|
|
|
2021-03-23 12:54:17 +01:00
|
|
|
/**
|
|
|
|
* @param $cmd
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
function command_exist( $cmd ) {
|
|
|
|
$return = shell_exec( sprintf( "which %s", escapeshellarg( $cmd ) ) );
|
2021-03-23 12:13:23 +01:00
|
|
|
|
2021-03-23 12:54:17 +01:00
|
|
|
return ! empty( $return );
|
|
|
|
}
|
2021-03-23 12:13:23 +01:00
|
|
|
|
2021-03-23 12:54:17 +01:00
|
|
|
if ( isset( $_POST[ 'url' ] ) ) {
|
|
|
|
// sanitize input
|
2021-03-23 12:13:23 +01:00
|
|
|
|
2021-03-23 12:54:17 +01:00
|
|
|
$url = $_POST[ 'url' ];
|
|
|
|
|
|
|
|
echo "<br/>récupération de la vidéo à l'url " . $url . " ... <br>";
|
2021-03-23 12:13:23 +01:00
|
|
|
|
|
|
|
// if (!command_exist('youtube-dl')) {
|
|
|
|
// print '[Erreur] pas de commande youtube-dl installée sur ce serveur';
|
|
|
|
// } else {
|
|
|
|
|
2021-03-23 12:54:17 +01:00
|
|
|
$uniqid = time();
|
|
|
|
|
2021-03-27 09:13:03 +01:00
|
|
|
// # exemple url https://peertube.cipherbliss.com/videos/watch/e6a37508-042e-4d83-8598-5d36b764bb3d
|
2021-03-23 12:13:23 +01:00
|
|
|
|
2021-03-23 13:26:29 +01:00
|
|
|
|
2021-03-27 09:13:03 +01:00
|
|
|
exec( './youtube-dl.sh uniqueid_facho https://peertube.cipherbliss.com/videos/watch/b88a9568-517c-4a49-ab07-75c79323a825', $output, $result );
|
2021-03-23 13:26:29 +01:00
|
|
|
// exec( '.'.$old . '/test.sh ' . $uniqid . ' ' . $url, $output, $result );
|
2021-03-23 12:13:23 +01:00
|
|
|
|
2021-03-23 12:54:17 +01:00
|
|
|
echo "<br/> résultat du script. <br>";
|
|
|
|
var_dump( $result );
|
|
|
|
echo "<br/> sortie du script. <br>";
|
|
|
|
var_dump( $output );
|
|
|
|
if ( $result ) {
|
|
|
|
echo( '<div class="alert is-danger"> problème de script </div>' );
|
|
|
|
include( '_foot.php' );
|
|
|
|
}
|
|
|
|
// récup du nom de fichier
|
|
|
|
echo "<br/>récupération de la vidéo OK. <br>";
|
2021-03-18 23:04:04 +01:00
|
|
|
|
|
|
|
|
2021-03-23 12:54:17 +01:00
|
|
|
echo "<br/>Conversion de la vidéo " . $uniqid . "... <br>";
|
2021-03-18 23:04:04 +01:00
|
|
|
|
2021-03-23 12:54:17 +01:00
|
|
|
echo "Vous pouvez télécharger vos fichiers.<br>";
|
2021-03-18 23:04:04 +01:00
|
|
|
|
2021-03-23 12:54:17 +01:00
|
|
|
$dir = scandir( '../input/ydl/' . $uniqid );
|
|
|
|
var_dump( $dir );
|
2021-03-23 12:13:23 +01:00
|
|
|
// }
|
2021-03-18 23:04:04 +01:00
|
|
|
|
|
|
|
|
2021-03-23 12:54:17 +01:00
|
|
|
} else {
|
|
|
|
echo " <br> pas d'url envoyée. Vérifiez le formulaire. <a href='index.php'>Retour</a>";
|
|
|
|
}
|
2021-03-18 23:04:04 +01:00
|
|
|
|
2021-03-23 13:26:29 +01:00
|
|
|
exec( './youtube-dl.sh canadien https://www.youtube.com/watch?v=w97pAEr3svc', $output, $result );
|
|
|
|
|
2021-03-23 12:54:17 +01:00
|
|
|
?>
|
2021-03-18 23:04:04 +01:00
|
|
|
|
2021-03-23 12:54:17 +01:00
|
|
|
</div>
|
|
|
|
<?php
|
2021-03-23 12:13:23 +01:00
|
|
|
include( '_foot.php' );
|