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

183
Visualizações
Greasemonkey / Tampermonkey Create a link from text on an Amazon page

N00b to scripting so apologies in advance...
I am looking use TamperMonkey to create a link from text on a page where it will take the result and search for it against another website.

I'm looking to take the Trade Register Number, turn it into a link that takes that number and runs it against a UK HMRC website. The final link looking something like this: https://find-and-update.company-information.service.gov.uk/company/12345678/officers

Detailed Seller Information:
Business Name:Fake Name Ltd
Business Type:Privately-owned business
Trade Register Number:1234578
VAT Number:GB123456789

I've spend a couple of hours butchering snippets taken from here and everywhere else, and am no closer than when I started.
Any help would be greatly appreciated.

<div class="a-row a-spacing-medium">
  <div class="a-column a-span6">
    <hr aria-hidden="true" class="a-spacing-medium a-spacing-top-medium a-divider-normal">
    <h3 id="-component-heading" class="a-spacing-large">
      Detailed Seller Information
    </h3>
    <ul class="a-unordered-list a-nostyle a-vertical">
      <li><span class="a-list-item"><span class="a-text-bold">Business Name:</span>Fake Name Ltd</span>
      </li>
      <li><span class="a-list-item"><span class="a-text-bold">Business Type:</span>Privately-owned business</span>
      </li>
      <li><span class="a-list-item"><span class="a-text-bold">Trade Register Number:</span>12354678</span>
      </li>
      <li><span class="a-list-item"><span class="a-text-bold">VAT Number:</span>GB123456789</span>
      </li>
      <li><span class="a-list-item"><span class="a-text-bold">Phone number:</span>01234 567890</span>
      </li>

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I haven't messed around with Greasemonkey or Tampermonkey too much, but as far as a simple script to convert those Trade Register Number values into URLs (following the format you provided), this should do the trick.

document.querySelector(".a-unordered-list.a-nostyle.a-vertical").querySelectorAll("li").forEach(el => {
    if(el.textContent.split(":")[0] == "Trade Register Number") {
        el.innerHTML = `<span class="a-text-bold">Trade Register Number:</span><a href="https://find-and-update.company-information.service.gov.uk/company/${el.textContent.split(":")[1]}/officers" target="_blank">${el.textContent.split(":")[1]}</a>`;
    }
});
<div class="a-row a-spacing-medium">
  <div class="a-column a-span6">
    <hr aria-hidden="true" class="a-spacing-medium a-spacing-top-medium a-divider-normal">
    <h3 id="-component-heading" class="a-spacing-large">
      Detailed Seller Information
    </h3>
    <ul class="a-unordered-list a-nostyle a-vertical">
      <li><span class="a-list-item"><span class="a-text-bold">Business Name:</span>Fake Name Ltd</span>
      </li>
      <li><span class="a-list-item"><span class="a-text-bold">Business Type:</span>Privately-owned business</span>
      </li>
      <li><span class="a-list-item"><span class="a-text-bold">Trade Register Number:</span>12354678</span>
      </li>
      <li><span class="a-list-item"><span class="a-text-bold">VAT Number:</span>GB123456789</span>
      </li>
      <li><span class="a-list-item"><span class="a-text-bold">Phone number:</span>01234 567890</span>
      </li>
    </ul>
  </div>
</div>

This will only run for 1 set of seller information. If there are multiple listed on the page, I would need to see the HTML for that to properly make it loop through all records on the page.

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