Answer the question
In order to leave comments, you need to log in
Extracting data from a web page, how?
Please tell me, is it possible to somehow extract data (for example, some kind of number) from the web page that I currently open and save it to a text file?
Interested in the local method.
Maybe some special browser or program?
Is it possible?
For example, now I have a web page with this question open and I want to write only the text of the question to a text file.
Windows environment.
Answer the question
In order to leave comments, you need to log in
watch the videos:
https://www.youtube.com/results?search_query=chrom...
switch to chrome debug mode by pressing F12
in debug mode press Ctrl+shift+C , then hover over the question text on the page and click, on the right in debugging, the source with the specified element will open
<div class="question__text js-question-text" itemprop="text description">
....
let text = document.querySelector(".question__text.js-question-text").textContent;
console.log(text);
let obj = {
"filename": "file.txt",
"url": 'text/plain;charset=UTF-8,' + encodeURIComponent(text),
"conflictAction": "prompt",
"saveAs": true
};
chrome.downloads.download(obj);
let text = document.querySelector(".question__text.js-question-text").textContent;
let a = document.createElement("a");
a.setAttribute("href", "data:text/plane;base64,"+window.btoa(unescape(encodeURIComponent(text))));
a.setAttribute("download","YourFileName.txt");
a.click();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question