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

174
Vistas
GetElements from a URL with powershell

I am trying to get all links for each object, in order to make a log of which items are new and which are old

I dont understand how to grab links from a shopping website...

Tis is the code that works.

$URI = 'http://superwidgets.wordpress.com/category/sql/'
$HTML = Invoke-WebRequest -Uri $URI
($HTML.ParsedHtml.getElementsByTagName('h2') | Where{ $_.className -eq 'entry-title' } )

(Ref: https://social.technet.microsoft.com/wiki/contents/articles/26009.getting-information-from-web-pages-via-powershell.aspx )

This code does not

$url = 'https://www.norrona.com/nb-NO/o/herre/?displaysize=L%7CM&s=7&h=69000'
$x = Invoke-WebRequest -Uri $URL
($x.ParsedHtml.getElementsByTagName('div') | Where{ $_.className -eq 'productcard' } )

WHY?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

This works but there is no div element with a productcard classname. Html and Javascript are just a bunch of text that are not rendered by any browser when retrieved from PowerShell. This means all the javascript is not executed.

There is a <script> element that is:

<script src="/api/translation/JavascriptInject?groups=Global&amp;groups=ProductList&amp;groups=Product&amp;groups=Payment&amp;groups=PrePurchase"></script>
<main id="vueProductList" role="main">
</main>

that probably should be invoked to render the elements you look for. But this is another call to another web ressource that probably return javascript objects. This doesn't tell if the objects would be styled with a productcard CSS class when rendered by javascript code.

This is probably not the right way to get the product list. You should directly access the API (if available) to get the list of products. You can then use PowerShell to convert json to powershell objects with ConvertFrom-Json cmdlet.

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