1

I'm using exec php function to run a script that grabs a YouTube video in mp3 format (with youtube-dl).

At the end of this script I made an echo, this is the result I want.

But when I launch my php page, the output is composed of everything youtbe-dl did. Like that:

    [youtube] zTkS9SvhHUI: Downloading webpage
    [youtube] zTkS9SvhHUI: Downloading video info webpage
    [youtube] zTkS9SvhHUI: Extracting video information
    [youtube] zTkS9SvhHUI: Downloading js player en_US-vflgFv_Kx
    [youtube] zTkS9SvhHUI: Downloading js player en_US-vflgFv_Kx
    [download] Destination: /var/www/xxx/mp3dl/Kaskade - Whatever Ft KOLAJ (NEUS Remix).webm 
    [download] 0.0% of 3.84MiB at 10.17KiB/s ETA 06:26 
    [download] 0.1% of 3.84MiB at 30.44KiB/s ETA 02:09 
    [. . .] 
    [download] 100.0% of 3.84MiB at 4.01MiB/s ETA 00:00 
    [download] 100% of 3.84MiB in 00:00
    [ffmpeg] Destination: /var/www/xxx/mp3dl/Kaskade - Whatever Ft KOLAJ (NEUS Remix).mp3
    Deleting original file /var/www/xxx/mp3dl/Kaskade - Whatever Ft KOLAJ (NEUS Remix).webm (pass -k to keep)
    /var/www/xxx/mp3dl/Kaskade - Whatever Ft KOLAJ (NEUS Remix).mp3

The only thing I need is :

/var/www/xxx/mp3dl/Kaskade - Whatever Ft KOLAJ (NEUS Remix).mp3

How can I do that? Is there something I did not understand?

EDIT : There is my php code :

$url = htmlspecialchars($_POST['url']);
$choice1 = $_POST['choice1'];
$output = exec('sh scripts/ytdlmp3_direct.sh "'.$url.'"');
if(isset($_POST['action'])){
    if(empty($url)) {
        print("<div class='card-panel yellow'>Please add a URL</div>")  ;
    } else {
        if($choice1 == "download") {
            print $output;
        } elseif($choice1 == "store") {
            print "Soon";
        }
    }
}

Thanks! ~Quentin

1 Answer 1

1

Add -q OR --quiet to your command via exec() and it will not output any of the "debug" messages.

From the documentation

-q, --quiet Activate quiet mode

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.