Advertisement
dereksir

Untitled

Nov 23rd, 2023 (edited)
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.71 KB | None | 0 0
  1. async def main():
  2.     # ... (previous code remains unchanged)
  3.  
  4.      # Process the extracted information
  5.     for url, soup in zip(urls, htmls):
  6.         # Find products in <ul>
  7.         product_list = soup.find('ul', class_='products')
  8.         # Find all <li>s
  9.         products = product_list.find_all('li')
  10.         # Iterate through products and extract name, price, and image of each.
  11.         for product in products:
  12.             name = product.find('h2').text
  13.             price = product.find('span', class_='amount').text
  14.             image = product.find('img')['src']
  15.  
  16.             print(f"Product from {url}:\nName: {name}\nPrice: {price}\nImage: {image}\n")
  17.  
  18.     # ... (rest of the code remains unchanged)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement