This commit is contained in:
13danny13
2023-04-05 11:48:31 +03:00
parent 6a8fc8cf53
commit a0f90f6848
+3 -3
View File
@@ -25,17 +25,17 @@ price = soup.find_all('span', class_="price")
priceDis = soup.find_all('span', class_="discount") priceDis = soup.find_all('span', class_="discount")
pictures = soup.find_all('div', class_="img") pictures = soup.find_all('div', class_="img")
for i in range(20): for i in range(20):
url = 'https://trial-sport.ru/gds.php?s=51516&c1=1070639&c2=1070640'+pictures[i].find('a').find('img')['src'] url = 'https://trial-sport.ru/gds.php?s=51516&c1=1070639&c2=1070640'+pictures[i].find('a').find('img')['src']
filename = f"E:\Downloads\parcing\img\{i}.jpg" filename = f"E:\Downloads\parcing\img\{i}.jpg"
wget.download(url, filename) wget.download(url, filename)
ins_qwery = f"""insert into public.Parser(product_name, description, price, priceDis, scr) cursor.execute(f"""insert into Parsing (product_name, description, price, priceDis, scr)
VALUES ('{product_name[i].text}','{description[i].text}', '{price[i].text}', '{priceDis[i].text}', '{filename}')""" VALUES ('{product_name[i].text}','{description[i].text}', '{price[i].text}', '{priceDis[i].text}', '{filename}')""")
connection.commit() connection.commit()
cursor.close() cursor.close()
connection.close() connection.close()