Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

156
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!