Update Tester.HTML

This commit is contained in:
Dangrainage 2024-04-25 08:52:50 +02:00 committed by GitHub
parent 3d27eaff53
commit 152361447c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -43,14 +43,32 @@
let listItem = document.createElement('li');
let link = document.createElement('a');
link.textContent = `${result.title} (${result.year})`;
link.href = result.link; // Assuming there's a 'link' property in the dictionary
link.target = '_blank'; // Open link in a new tab
link.href = "#"; // Set a placeholder href
link.addEventListener('click', function(event) {
event.preventDefault();
generateDynamic(result.link);
});
listItem.appendChild(link);
resultList.appendChild(listItem);
});
searchResultsDiv.appendChild(resultList);
}
}
function generateDynamic(href) {
fetch(`https://filmer.anorak01.top/vid/${href.split("//")[1]}`)
.then(response => response.json())
.then(data => {
if (data.url) {
window.location.href = data.url; // Redirect to the generated link
} else {
console.error('Error: Unable to fetch video link');
}
})
.catch(error => {
console.error('Error:', error);
});
}
</script>
</body>
</html>