Yazılım Soru - Kod Kısmı
import requests
from bs4 import BeautifulSoup
import json
import time
returnResponse = [];
for pageNumber in range(10):
url = "https://suchen.mobile.de/fahrzeuge/search.html?damageUnrepaired=ALSO_DAMAGE_UNREPAIRED&isSearchRequest=true&od=down&pageNumber=" + str(pageNumber + 1)
response = requests.get(url, verify=False).content
soup = BeautifulSoup(response, "html.parser")
carList = soup.find_all('div', {'class': 'cBox-body cBox-body--resultitem'})
for car in carList:
carName = car.find("span",{"class":"h3 u-text-break-word"}).text
carPrice = car.find("span",{"class":"h3 u-block"}).text
carPrice = carPrice.replace("\xa0", " ");
returnResponse.append({
'carName': carName,
'carPrice': carPrice
})
time.sleep(10)
#jsonFormattedString = json.dumps(returnResponse, indent=2)
#fileManager = open('result.json', 'a')
#fileManager.write(jsonFormattedString)
#fileManager.close()