Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

200
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda