Skip to content

Commit

Permalink
Update privacy_policy_tnt_maroc.html
Browse files Browse the repository at this point in the history
  • Loading branch information
itech-apps authored Aug 12, 2024
1 parent 83874e6 commit ab71734
Showing 1 changed file with 18 additions and 36 deletions.
54 changes: 18 additions & 36 deletions privacy_policy_tnt_maroc.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,43 +12,25 @@
window.addEventListener("load", () => {
console.log("This function is executed once the page is full loaded");
});

function scraper(){
// Make a cross-origin request using XMLHttpRequest or fetch API

const url = 'https://callofliberty.fr/tv/tv.php';

const xhr = new XMLHttpRequest();

xhr.open('GET', url, true);

// Include CORS headers

//xhr.setRequestHeader('Content-Type', 'application/json');

xhr.setRequestHeader('Access-Control-Allow-Origin', '*'); // Replace * with your domain if needed

xhr.setRequestHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS'); // Specify allowed HTTP methods

xhr.setRequestHeader('Access-Control-Allow-Headers', 'Origin, Content-Type, Accept'); // Specify allowed headers

xhr.onreadystatechange = function () {

if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) {

// Handle the response

console.log(xhr.responseText);

}

};

xhr.send();
}
async function scrapeData() {
try {
const response = await fetch("https://callofliberty.fr/tv/tv.php");
const html = await response.text();
const parser = new DOMParser();
const doc = parser.parseFromString(html, "text/html");
const bookTitles = doc.querySelectorAll('h3 a');
bookTitles.forEach(function(title) {
const bookTitle = title.textContent;
console.log(bookTitle);
storeData(bookTitle);
});
} catch (error) {
console.log(error);
}
}

scrapeData();


scraper();
</script>
</html>

0 comments on commit ab71734

Please sign in to comment.