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

185
Vistas
How do I reorder google results after search? I want to create an extension that can reorder the results of a google search

I am trying to create an extention that can reorder google results if I search for something like "how to make a paper airplane". Right now I just want to be able to change 2 link's orders. For example my current code

var xpath = function(xpathToExecute){
  var result = [];
  var nodesSnapshot = document.evaluate(xpathToExecute, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null );
  for ( var i=0 ; i < nodesSnapshot.snapshotLength; i++ ){
    result.push( nodesSnapshot.snapshotItem(i) );
  }
  return result;
}

var xps = xpath('//*[@id="rso"]/div')

finalDivs = []

for (var i = 0; i < xps.length; i += 1 ) {
    if (xps[i].className == 'g' || xps[i].className == 'hlcw0c') {
        finalDivs.push(xps[i])
    }
}

This allows me to obtain an object with all relevant div tags. I can then assign each div to a ranking by creating another object, but I am unsure how I can then reorder the search results based on these results. Is there a way to reinject the div order back into the webpage I am on? The code I am currently using is put into the sources tab like this:

Where code is being run

Any guidance is greatly appreciated!

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