mirror of
https://github.com/KUlishevgeniy/c22712.git
synced 2026-09-24 08:00:22 +00:00
minor changes
This commit is contained in:
@@ -21,8 +21,11 @@ with psyc.connect(dbname="db_for_parse", user="perfecto") as conn:
|
|||||||
img_tag = product.find(attrs={"class": "imagef"}).find("img")
|
img_tag = product.find(attrs={"class": "imagef"}).find("img")
|
||||||
title = img_tag.attrs.get("alt")
|
title = img_tag.attrs.get("alt")
|
||||||
image = url + img_tag.attrs.get("src")
|
image = url + img_tag.attrs.get("src")
|
||||||
|
price = product.find(attrs={"class": "product-price"}).text
|
||||||
|
desc = product.find(attrs={"class": "product-desc"}).text
|
||||||
download(url + img_tag.attrs.get("src"), f"images/{i}.jpg")
|
download(url + img_tag.attrs.get("src"), f"images/{i}.jpg")
|
||||||
|
|
||||||
cursor.execute(f"insert into images(link, name) values ('{image}', '{title}')")
|
cursor.execute(f"""insert into images(link, name, price, description, file)
|
||||||
|
values ('{image}', '{title}', '{price}', '{desc}', 'images/{i}.jpg')""")
|
||||||
|
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
|||||||
Reference in New Issue
Block a user