Skip to content

Commit

Permalink
Update javascript.js
Browse files Browse the repository at this point in the history
  • Loading branch information
theofficialvkr authored Feb 10, 2024
1 parent 4b40d5b commit cb04cfc
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ function generateDownloadButtons(data) {
for (let i = 0; i <= 40; i++) {
if (data["dl" + i] && data["dl" + i]["url"]) {
const downloadUrl = data["dl" + i]["url"];
//const bgColor = getBackgroundColor(getParameterByName("itag",$downloadUrl);
const videoFrmt = data["dl" + i]["format"] ;
const bgColor = getBackgroundColor(getParameterByName("itag", downloadUrl));
const videoFrmt = data["dl" + i]["format"];
downloadV.innerHTML += `<a href='${downloadUrl}'><button class='dlbtn' style='background:${bgColor}'>${videoFrmt}</button></a>`;
}
}
Expand All @@ -89,8 +89,7 @@ function generateDownloadButtons(data) {
// Function to get the background color for download buttons
function getBackgroundColor(downloadUrlItag) {
// Logic to determine button color based on video information
// Example: return "green"; for some conditions, return "#3800ff"; for others, etc.
const greenFormats = ["17", "18", "22"];
const greenFormats = ["17", "18", "22"];
const blueFormats = ["139", "140", "141", "249", "250", "251", "599", "600"];

if (greenFormats.includes(downloadUrlItag)) {
Expand All @@ -112,5 +111,5 @@ function getParameterByName(name, url) {
if (!results[2]) return '';

return decodeURIComponent(results[2].replace(/\+/g, ' '));
}

}

0 comments on commit cb04cfc

Please sign in to comment.