CPScript / Ideas

some of my ideas for software will be put here... and i will explain how i will try to make them work

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stupid Ideas:


Website reader (used to answer questions on a webite like google forums)

First, we need to fetch the content of the webpage. For simplicity, let's assume we're working within the same domain due to cross-domain restrictions. We can use the fetch API to get the HTML content of the page:

fetch('yourPageUrl')
   .then(response => response.text())
   .then(data => {
       const parser = new DOMParser();
       const doc = parser.parseFromString(data, 'text/html');
       // Process the parsed HTML...
   })
   .catch((error) => console.error('Error:', error));

Next, we parse the HTML and look for the questions. Assuming the questions are inside <p> tags and the options are inside <ul> tags, we could do something like this:

let questions = Array.from(doc.querySelectorAll('p'));
questions.forEach((questionElement, index) => {
   let questionText = questionElement.innerText;
   let options = Array.from(questionElement.nextElementSibling.querySelectorAll('li'));
   options.forEach((optionElement, optionIndex) => {
       let optionText = optionElement.innerText;
       // Now you have the question and the option, you can compare them and check if they match
   });
});

About

some of my ideas for software will be put here... and i will explain how i will try to make them work