used a faster version of youtube-dl(#36);fixed yt binary download issuse;cleaning up

This commit is contained in:
huangjx
2022-03-05 09:58:05 +08:00
parent c8df2b9821
commit c7fd0f32af
2 changed files with 23 additions and 29 deletions

View File

@@ -174,8 +174,17 @@ class Helper
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$result = curl_exec($ch);
if (curl_errno($ch)) {
$error = 'Error:' . curl_error($ch);
}
curl_close($ch);
file_put_contents($file, $result);
if (isset($error)) {
throw new \Exception($error);
} else {
if (!file_put_contents($file, $result)) {
throw new \Exception("failed to save " . $file);
}
}
}
public static function is_function_enabled($function_name)