My main goal:
I want to create a web-app that allows the user to input a url, and my program will 'go' to that website and essentially ctrl + a, ctrl + c, and paste store it as an array of strings. (Basically I want to obtain only the text that you could get using ctrl+a) I want to use Node.js to do this as I know it can make connections with websites. I have been searching the web for a while and haven't found anything of use.
Is there a way to do this?
My project: I am creating a speed reading app but I want to go beyond the user simply copying and pasting into a text box. That is why I want to be able to take the text from basically any website. I am using WebStorm to work on my project.
I have tried what was suggested on: https://www.codegrepper.com/code-examples/javascript/extract+all+text+from+website+node+js
//eventhough deprecated, still able to use
const request = require('request');
request('http://www.google.com', function (error, response, body) {
console.error('error:', error); // Print the error if one occurred
console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
console.log('body:', body); // Print the HTML for the Google homepage.
});
But this does not get me what I want. This simply pulls all the stuff from the body of the HTML.
Use headless browser like Puppeteer.