Skip to content
Predicting hotel cancellation
import requests
from bs4 import BeautifulSoup
# Make a request to the webpage
url = 'https://www.amazon.com/deal/da01098a/?_encoding=UTF8&moreDeals=0293b628&_ref=dlx_gate_dd_dcl_tlt_da01098a_dt&pd_rd_w=6GPhF&content-id=amzn1.sym.def2f06c-d9a7-4927-8433-aa333a9fca53&pf_rd_p=def2f06c-d9a7-4927-8433-aa333a9fca53&pf_rd_r=1VKA3439ZSMTKPMPFTNV&pd_rd_wg=VBxpd&pd_rd_r=d754b607-7c24-4d65-87db-588ad269c9a9&ref_=pd_gw_unk'
response = requests.get(url)
# Parse the HTML content
soup = BeautifulSoup(response.content, 'html.parser')
# Find the product elements and extract information
products = soup.find_all('div', class_='widgetContent')
for product in products:
name = product.find('span', class_='dealTitle').text.strip()
size = product.find('span', class_='dealDetails').text.strip()
price = product.find('span', class_='a-price').text.strip()
# Process the extracted information (e.g., store in a database, print, etc.)
print('Product:', name)
print('Size:', size)
print('Price:', price)
print()