Skip to content

Commit

Permalink
Changed ytdl parameters for better download
Browse files Browse the repository at this point in the history
  • Loading branch information
farhang-sa committed Jul 2, 2024
1 parent 4001b3b commit be3e8a3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dist/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ function ytdl_make_name( $fileName ){
$link = $_POST[ 'link' ];
$quality = isset( $_POST['quality'] ) ? $_POST['quality'] : null;
if( strtolower( $link ) === 'clear' || strtolower( $link ) === 'clean' ){
shell_exec( $isLinux ? 'rm *.mp4 && rm *.webm' : 'del *.mp4 && del *.webm' );
shell_exec( $isLinux ? 'rm *.mp4' : 'del *.mp4' );
shell_exec( $isLinux ? 'rm *.webm' : 'del *.webm' );
die( 'all videos deleted' ) ;
} else if( stristr( $link , 'cleanfile:' ) !== false ){
$link = str_ireplace( 'cleanfile:' , '' , $link );
Expand All @@ -77,8 +78,8 @@ function ytdl_make_name( $fileName ){
$videos .= '}' ;
die( $videos );
} // else :
$down = "-f 'bestvideo" . ( $quality ? "[height=$quality]" : '' ) . "+bestaudio'";
$down = shell_exec( $exFile . ' ' . $down . ' ' . $link );
$down = $down = $quality ? ' -S "res:'. $quality . '"' : '' ;
$down = shell_exec( $exFile . $down . ' ' . $link );
$down = explode( "[download]" , $down );
if( is_array( $down ) ) foreach( $down as $intel ){
$intel = trim( $intel , " /\\\r\n\t" );
Expand Down

0 comments on commit be3e8a3

Please sign in to comment.