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

248
Vistas
Javascript - how to pull the correct content from an element

I am trying to run a javascript that will pull salaries off a webpage, do a calculation, then edit the webpage to show a new number (automating right click -> inspect).

I have been following a guide on how to scrape a webpage and put the desired elements into a .txt file. I have amended the code to look up salaries of jobs. However when I run node. scrapesalaries.js it pulls through the location and the salary.

Is there a way I can only pull through the salary? Code below.

var request = require('request');
var cheerio = require('cheerio');
var fs = require('fs');

request("https://www.reed.co.uk/jobs/manager-jobs", function(error, response, body) {
  if(error) {
    console.log("Error: " + error);
  }
  console.log("Status code: " + response.statusCode);

  var $ = cheerio.load(body);

  $('div.row:has(ul.job-metadata)').each(function( index ) {
    var title = $(this).find('ul.job-metadata > li').text().trim();
    var link = $(this).find('ul.job-metadata > li').attr('href');
    fs.appendFileSync('salaries.txt', title + '\n' + link + '\n');
  });

});
about 4 years ago · Juan Pablo Isaza
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