Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

195
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda