Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

194
Views
Save content to file in chrome extension

I want to get to a web page, extract the information I need and then write it in a text file and download it. I couldn't find a way to download or copy the text.

I made an extension which can download text in the popup script, and has the text I need in the content script but how to I connect them both?

content script:

let wordsList = [];
let meaningList = [];
let words = document.querySelectorAll(".status-m > div.word, .status-n > div.word");
let meaning = document.querySelectorAll(".status-m > div.meaning, .status-n > div.meaning");

wordsList = [...words];
wordsList = wordsList.map(word => word.innerHTML)

meaningList = [...meaning];
meaningList = meaningList.map(word => word.innerHTML)

let obj = {}
for(let i = 0; i< wordsList.length; i++){
    obj[wordsList[i]] = meaningList[i]
}

console.log(obj)

popup script:

$(function(){      
    $('.btn').click(function(){
        const blob = new Blob(['text to download'],
            { type: "text/plain; charset=utf-8" });
        saveAs(blob, "static.txt");
    })
})
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

may use Powerpage command line to scrape a web page. program can be downloaded at https://github.com/casualwriter/powerpage

// crawl innerHTML to html
powerpage.exe /url={link-web-page} /save={local-file.html} /select=".status-m > div.word, .status-n > div.word"

// crawl innerText to html
powerpage.exe /url={link-web-page} /save={local-file.html} /select="@.status-m > div.word, .status-n > div.word"
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!