Skip to content

Commit

Permalink
Merge branch 'fix-wistia-27-nov'
Browse files Browse the repository at this point in the history
  • Loading branch information
sumeetweb committed Nov 27, 2024
2 parents afcaa5e + ba67cc3 commit 6451b27
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
29 changes: 14 additions & 15 deletions include/downloader.functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand All @@ -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);
}
}

Expand Down
5 changes: 1 addition & 4 deletions include/wistia.downloader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 6451b27

Please sign in to comment.