diff --git a/include/downloader.functions.php b/include/downloader.functions.php index 9225ad9..1d93537 100644 --- a/include/downloader.functions.php +++ b/include/downloader.functions.php @@ -69,22 +69,20 @@ function chapterwise_download($datas) preg_match_all($regex, $temp2, $audio_matches, PREG_SET_ORDER, 0); $audio_matches = array_unique($audio_matches, SORT_REGULAR); - if (empty($video_set_matches) && empty($audio_matches)) { - echo "No matches found for videos or audio in HTML Item. Continuing..."; - } else { - if (!empty($video_set_matches)) { - foreach ($video_set_matches as $match) { - $video_url = $match[0]; - video_downloader_videoproxy($video_url, filter_filename($content["name"]), $video_download_quality); - } + if (!empty($video_set_matches)) { + echo "Found Videoproxy in HTML Item".PHP_EOL; + foreach ($video_set_matches as $match) { + $video_url = $match[0]; + video_downloader_videoproxy($video_url, filter_filename($content["name"]), $video_download_quality); } + } - if (!empty($audio_matches)) { - foreach ($audio_matches as $match) { - $audio_url = $match[0]; - $audio_name = filter_filename(basename($audio_url)); - downloadFileChunked($audio_url, $audio_name); - } + if (!empty($audio_matches)) { + echo "Found Audios in HTML Item".PHP_EOL; + foreach ($audio_matches as $match) { + $audio_url = $match[0]; + $audio_name = filter_filename(basename($audio_url)); + downloadFileChunked($audio_url, $audio_name); } } @@ -96,12 +94,13 @@ function chapterwise_download($datas) $first_set_matches = array_unique($matches, SORT_REGULAR); if(!empty($first_set_matches)) { + echo "Found Wistia Videos in HTML Item".PHP_EOL; foreach($first_set_matches as $match) { $embed_video_url = $match[0]; $wistia_id = explode("/", $embed_video_url); $wistia_id = end($wistia_id); - video_downloader_wistia($wistia_id, $fname, $video_download_quality); + video_downloader_wistia($wistia_id, filter_filename($content["name"]), $video_download_quality); } } diff --git a/include/wistia.downloader.php b/include/wistia.downloader.php index f627614..4103f6b 100644 --- a/include/wistia.downloader.php +++ b/include/wistia.downloader.php @@ -38,10 +38,7 @@ function video_downloader_wistia($wistia_id, $file_name, $quality = "720p") { } $full_hd_url = $video_assets[$video_assets_index]["url"]; - if($final_video_data["media"]["assets"][$video_assets_index]["ext"] == "") - $file_name = $file_name.".mp4"; - else - $file_name = $file_name.".".$final_video_data["media"]["assets"][$video_assets_index]["ext"]; + $file_name = filter_filename($final_video_data["media"]["name"]); echo "URL : ".$full_hd_url."\n"; echo "File Name : ".$file_name."\n";