Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async def main():
- # ... (previous code remains unchanged)
- # Process the extracted information
- for url, soup in zip(urls, htmls):
- # Find products in <ul>
- product_list = soup.find('ul', class_='products')
- # Find all <li>s
- products = product_list.find_all('li')
- # Iterate through products and extract name, price, and image of each.
- for product in products:
- name = product.find('h2').text
- price = product.find('span', class_='amount').text
- image = product.find('img')['src']
- print(f"Product from {url}:\nName: {name}\nPrice: {price}\nImage: {image}\n")
- # ... (rest of the code remains unchanged)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement