mirror of
https://github.com/timendum/Youtube-dl-WebUI.git
synced 2025-03-01 08:03:28 +08:00
URLs validity check
This commit is contained in:
parent
a54409d624
commit
e4a729ac74
1 changed files with 19 additions and 0 deletions
|
@ -20,6 +20,20 @@ class Downloader
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach ($this->urls as $url)
|
||||||
|
{
|
||||||
|
if(!$this->is_valid_url($url))
|
||||||
|
{
|
||||||
|
$this->errors[] = "\"".$url."\" is not a valid url !";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(isset($this->errors) && count($this->errors) > 0)
|
||||||
|
{
|
||||||
|
$_SESSION['errors'] = $this->errors;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if($this->config["max_dl"] == 0)
|
if($this->config["max_dl"] == 0)
|
||||||
{
|
{
|
||||||
$this->do_download();
|
$this->do_download();
|
||||||
|
@ -140,6 +154,11 @@ class Downloader
|
||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function is_valid_url($url)
|
||||||
|
{
|
||||||
|
return filter_var($url, FILTER_VALIDATE_URL);
|
||||||
|
}
|
||||||
|
|
||||||
private function check_outuput_folder()
|
private function check_outuput_folder()
|
||||||
{
|
{
|
||||||
if(!is_dir($this->download_path))
|
if(!is_dir($this->download_path))
|
||||||
|
|
Loading…
Reference in a new issue