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

152
Vistas
script tag content doesnt get found via requests html (python)

i have a page where i want to extract a ean number from a script tag (here it is 8806090571589)

I tried to get the script firstly with

        jsonn = r.html.find('script')[3].text
        print(title, price, jsonn)

however that didnt work.

the source code of the page is on here (too long to post):

view-source:https://www.kaufland.de/product/361834606/?search_value=waschmaschine

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

0

When you use find(), it will return only the first occurrence of the tag. Since I can see that you need to find the 4th occurrence, you need to use the findAll() function. It will return a list of all the occurrences and then you can use any occurrence according to your needs.

I've tried using the below given code on my computer -

import urllib3
from bs4 import BeautifulSoup

URL = "https://www.kaufland.de/product/361834606/?search_value=waschmaschine"

response = urllib3.PoolManager().request("GET", URL, headers={'User-Agent' : "python"})
soup = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')

print(soup.findAll("script")[3])

You can take this code for reference and modify as per your needs.

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