Nov-25-2021, 04:17 PM
Hello,
I need some help with my Python-Script:
I want to make a web scraper to scrape some prices from this website:
https://www.medizinfuchs.de/?params%5Bse...h_cat%5D=1
I wrote following code:
It works sometimes - but too inconsistent.
I really don't know what I should be doing different.
Thanks for your help!
I need some help with my Python-Script:
I want to make a web scraper to scrape some prices from this website:
https://www.medizinfuchs.de/?params%5Bse...h_cat%5D=1
I wrote following code:
1 2 3 4 5 6 7 8 9 10 11 12 13 |
from bs4 import BeautifulSoup import requests my_headers = { "User-Agent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" , "Accept" : "text/html,application/xhtml+xml,application/xml; q=0.9,image/webp,image/apng,*/*;q=0.8" } page = requests.get(URL, headers = my_headers) soup = BeautifulSoup(page.text, "lxml" ) for price in soup.select( "ul.Apothekenliste div.price" ): print ( float (price.text.strip( ' \t\n€' ).replace( ',' , '.' ))) |
I really don't know what I should be doing different.
Thanks for your help!