I am scraping a web page with multiple pages. I would very much appreciate your help for my following problem:
I have built a loop around the URL of the web page. However, when looking for the tags in the HTML code only information from page one appears. It seems like the loop is not really flowing through. I unfortunately cannot find my mistake in the following code:
for pagenumber in range(1,50): url = "http://suchen.mobile.de/fahrzeuge/auto/search.html?zipcodeRadius=100&scopeId=C&ambitCountry=DE&makeModelVariant1.makeId=3500&makeModelVariant1.modelId=115%2C98%2C80%2C99%2C102%2C81%2C100%2C83%2C105%2C82%2C101%2C120%2C121&makeModelVariant1.modelGroupId=53&isSearchRequest=true&pageNumber + str(pageNumber)" r = requests.get(url) soup = BeautifulSoup(r.content,"lxml") # parsing the data from the webpage carTypeTemp=[] carTypeWeb = soup.find_all("span", {"class":"h3"}) # writing the car type/description in a list for i in range(0,len(carTypeWeb),2): carTypeTemp.extend((carTypeWeb[i]))
pagenumberis not the same aspageNumberand your final double quote should come before the plus sign.