diff --git a/Home/Python/23.03/DB1 b/Home/Python/23.03/DB1 deleted file mode 100644 index e69de29..0000000 diff --git a/Home/Python/23.03/DB1.py b/Home/Python/23.03/DB1.py deleted file mode 100644 index ac16e1b..0000000 --- a/Home/Python/23.03/DB1.py +++ /dev/null @@ -1,42 +0,0 @@ -import psycopg2 -import wget -from bs4 import BeautifulSoup -from selenium import webdriver -from selenium.webdriver.chrome.service import Service -# Парсер и загрузчик в БД//Антипенко Дмитрий -connection = psycopg2.connect(host='localhost', dbname='PythonDB', user='postgres', password='Q1w2e3r4') - -cursor = connection.cursor() - -creat_qwery = """ create table Parser - (id serial primary key, page_name varchar(100), price varchar(10), priceDis varchar(30), mark varchar(10), scr varchar(100))""" - -cursor.execute(creat_qwery) -connection.commit() - -driver = Service('D:\\teach\Prog\chromedriver.exe') -browser = webdriver.Chrome(service=driver) -browser.get('https://amwine.ru/catalog/igristoe_vino_i_shampanskoe/igristoe_vino/') -html_code = browser.page_source -b_soup = BeautifulSoup(html_code, 'lxml') -name = b_soup.find_all('a', class_="catalog-list-item__title js-product-detail-link") -price = b_soup.find_all('span', class_="middle_price") -priceDis = b_soup.find_all('span', class_="baseoldprice") -mark = b_soup.find_all('span', class_="product-rating__rating") -pictures = b_soup.find_all('div', class_="catalog-list-item__img-wrapper") - -for i in range(15): - url = 'https://amwine.ru'+pictures[i].find('a').find('img').attrs['data-src'] - filename = f"Programming\\23.03\img\{i}.jpg" - print(filename) - wget.download(url, filename) - ins_qwery = f"""insert into public.Parser(page_name, price, priceDis, mark, scr) values ('{name[i].text}', '{price[i].text}', '{priceDis[i].text}', '{mark[i].text}', '{filename}')""" - cursor.execute(ins_qwery) - connection.commit() - - - - -cursor.close() - -connection.close() \ No newline at end of file diff --git a/Home/Python/23.03/img/0.jpg b/Home/Python/23.03/img/0.jpg deleted file mode 100644 index a3605fb..0000000 Binary files a/Home/Python/23.03/img/0.jpg and /dev/null differ diff --git a/Home/Python/23.03/img/1.jpg b/Home/Python/23.03/img/1.jpg deleted file mode 100644 index c7aea3b..0000000 Binary files a/Home/Python/23.03/img/1.jpg and /dev/null differ diff --git a/Home/Python/23.03/img/10.jpg b/Home/Python/23.03/img/10.jpg deleted file mode 100644 index 2dccefe..0000000 Binary files a/Home/Python/23.03/img/10.jpg and /dev/null differ diff --git a/Home/Python/23.03/img/11.jpg b/Home/Python/23.03/img/11.jpg deleted file mode 100644 index 7688e9c..0000000 Binary files a/Home/Python/23.03/img/11.jpg and /dev/null differ diff --git a/Home/Python/23.03/img/12.jpg b/Home/Python/23.03/img/12.jpg deleted file mode 100644 index c7c0cb4..0000000 Binary files a/Home/Python/23.03/img/12.jpg and /dev/null differ diff --git a/Home/Python/23.03/img/13.jpg b/Home/Python/23.03/img/13.jpg deleted file mode 100644 index 4c1bf3b..0000000 Binary files a/Home/Python/23.03/img/13.jpg and /dev/null differ diff --git a/Home/Python/23.03/img/14.jpg b/Home/Python/23.03/img/14.jpg deleted file mode 100644 index bafbe29..0000000 Binary files a/Home/Python/23.03/img/14.jpg and /dev/null differ diff --git a/Home/Python/23.03/img/2.jpg b/Home/Python/23.03/img/2.jpg deleted file mode 100644 index c95a406..0000000 Binary files a/Home/Python/23.03/img/2.jpg and /dev/null differ diff --git a/Home/Python/23.03/img/3.jpg b/Home/Python/23.03/img/3.jpg deleted file mode 100644 index 0aab9e3..0000000 Binary files a/Home/Python/23.03/img/3.jpg and /dev/null differ diff --git a/Home/Python/23.03/img/4.jpg b/Home/Python/23.03/img/4.jpg deleted file mode 100644 index 576bce6..0000000 Binary files a/Home/Python/23.03/img/4.jpg and /dev/null differ diff --git a/Home/Python/23.03/img/5.jpg b/Home/Python/23.03/img/5.jpg deleted file mode 100644 index a7c53ab..0000000 Binary files a/Home/Python/23.03/img/5.jpg and /dev/null differ diff --git a/Home/Python/23.03/img/6.jpg b/Home/Python/23.03/img/6.jpg deleted file mode 100644 index 4b3ea13..0000000 Binary files a/Home/Python/23.03/img/6.jpg and /dev/null differ diff --git a/Home/Python/23.03/img/7.jpg b/Home/Python/23.03/img/7.jpg deleted file mode 100644 index 2cd8120..0000000 Binary files a/Home/Python/23.03/img/7.jpg and /dev/null differ diff --git a/Home/Python/23.03/img/8.jpg b/Home/Python/23.03/img/8.jpg deleted file mode 100644 index a22eee2..0000000 Binary files a/Home/Python/23.03/img/8.jpg and /dev/null differ diff --git a/Home/Python/23.03/img/9.jpg b/Home/Python/23.03/img/9.jpg deleted file mode 100644 index ceb59fe..0000000 Binary files a/Home/Python/23.03/img/9.jpg and /dev/null differ diff --git a/Home/Python/SortVibor.py b/Home/Python/SortVibor.py deleted file mode 100644 index d38560f..0000000 --- a/Home/Python/SortVibor.py +++ /dev/null @@ -1,30 +0,0 @@ -''' -print("Введите размер массива: ") -n = int(input()) -a = [int(input()) for i in range(n)] -''' -a = [4,3,2,5,1] -b = a.copy() -def sortSelect(arr): - for i in range(len(arr)-1): - ind = i - for j in range(i+1, len(arr)): - if(arr[ind]>arr[j]): - ind = j - arr[i], arr[ind] = arr[ind], arr[i] - return arr - - -def sortInsert(arr): - for i in range(len(arr)): - j = i-1 - x = arr[i] - while((arr[j]>x)and(j>=0)): - arr[j+1] = arr[j] - j -= 1 - arr[j+1] = x - return arr -#meow - - -print(sortSelect(a), sortInsert(b)) \ No newline at end of file diff --git a/Home/Python/other/NMisha.py b/Home/Python/other/NMisha.py deleted file mode 100644 index b19fa8b..0000000 --- a/Home/Python/other/NMisha.py +++ /dev/null @@ -1,43 +0,0 @@ -from bs4 import BeautifulSoup -from selenium import webdriver -from selenium.webdriver.chrome.service import Service -import psycopg2 -import wget - -# connection = psycopg2.connect(host='localhost', dbname='dbdata', user='postgres', password='Q1w2e3r4') -# cursor = connection.cursor() - -s = Service('D:\Games\data\chromedriver.exe') -browser = webdriver.Chrome(service=s) -browser.get('https://www.volkswagen.ru/polo/') -html_text = browser.page_source -soup = BeautifulSoup(html_text, 'lxml') - -# creat_table = """ create table Cars_volks -# (id serial primary key, car_name varchar(20), -# price varchar(15), adress varchar(40), -# scr varchar(100)) """ -#cursor.execute(creat_table) -# connection.commit() - -car_names = soup.find_all('div', class_='avn001-2_name') -prices = soup.find_all('div', class_='avn001-2_price-container') -adresses = soup.find_all('div', class_='avn001-2_dealer-link__text') -pictures = soup.find_all('div', class_='avn001-2_image image__container') - -#for car_name, adress, price in zip(car_names, adresses, prices): -# print(f"Название машины:{car_name.text} | Адрес диллера: {adress.text} | Цена: {price.text} рублей") - -for i in range(4): - url = pictures[i].find('img').attrs['src'] - filename = f"Programming\\other\\img\\img{i}.jpg" - print(filename) - wget.download(url, filename) - - # insert_qwery = f"""INSERT INTO public.Cars_volks(car_name, price, adress, scr) - # VALUES ('{car_names[i].text}', '{prices[i].text}', '{adresses[i].text}', '{filename}')"""; -# cursor.execute(insert_qwery) -# connection.commit() - -# cursor.close() -# connection.close() \ No newline at end of file diff --git a/Home/Python/other/Vova1.py b/Home/Python/other/Vova1.py deleted file mode 100644 index 6da424c..0000000 --- a/Home/Python/other/Vova1.py +++ /dev/null @@ -1,33 +0,0 @@ -from bs4 import BeautifulSoup -from selenium import webdriver -from selenium.webdriver.chrome.service import Service -import psycopg2 -import wget - -browser = webdriver.Chrome(service=Service('C:\Desktop\exe\chromedriver.exe')) -browser.get('https://flawery.ru/moscow/bouquets/event-yanvary25/') -soup = BeautifulSoup(browser.page_source, "lxml") -Name = soup.find_all(attrs={"class": "catalog_title"}) -Price = soup.find_all(attrs={"class": "catalog_price_now"}) -Delivery_Time = soup.find_all(attrs={"class": "catalog_express"}) -Delivery_Price = soup.find_all(attrs={"class": "catalog_delivery"}) -Image = soup.find_all('div', class_="catalog_item catalog_item_popup") - -connection = psycopg2.connect(host='localhost', dbname='FHWDB', user='postgres', password='Q1w2e3r4') -cursor = connection.cursor() -create_q = '''CREATE TABLE Parse -(ID serial primary key, Name varchar(100), Price varchar(9), Delivery_Time varchar(25), Delivery_Price varchar(20), src varchar(110))''' -cursor.execute(create_q) -connection.commit() - -for j in range(10): - url = 'https://flawery.ru'+Image[j].find('a').find('img').attrs['src'] - print(url) - tempf = f'C:\\Users\\user\\Desktop\\FHWDB{j}.jpg' - wget.download(url, tempf) - insert_query = f'''INSERT into public.Parse(Name, Price, Delivery_Time, Delivery_Price, scr) values ('{Name[j].text}', '{Price[j].text}', '{Delivery_Time[j].text}', '{Delivery_Price[j].text}', '{tempf}') ''' - cursor.execute(insert_query) - connection.commit() - -cursor.close() -connection.close() \ No newline at end of file diff --git a/Home/Python/other/img/img0.jpg b/Home/Python/other/img/img0.jpg deleted file mode 100644 index 2c2222e..0000000 Binary files a/Home/Python/other/img/img0.jpg and /dev/null differ diff --git a/Home/Python/other/img/img1.jpg b/Home/Python/other/img/img1.jpg deleted file mode 100644 index 46a6360..0000000 Binary files a/Home/Python/other/img/img1.jpg and /dev/null differ diff --git a/Home/Python/other/img/img2.jpg b/Home/Python/other/img/img2.jpg deleted file mode 100644 index c2b4556..0000000 Binary files a/Home/Python/other/img/img2.jpg and /dev/null differ diff --git a/Home/Python/other/img/img3.jpg b/Home/Python/other/img/img3.jpg deleted file mode 100644 index 46a6360..0000000 Binary files a/Home/Python/other/img/img3.jpg and /dev/null differ diff --git a/Home/Python/parser.py b/Home/Python/parser.py deleted file mode 100644 index ff3252b..0000000 --- a/Home/Python/parser.py +++ /dev/null @@ -1,40 +0,0 @@ - -#Вариант с пары -''' -from bs4 import BeautifulSoup -from selenium import webdriver -from selenium.webdriver.chrome.service import Service -import time - -S = Service('D:\teach\Prog\chromedriver.exe') #Открыли драйвер для хрома -browser = webdriver.Chrome(service=S) #Инициировали в отдельную переменную -browser.get('https://www.kinopoisk.ru/lists/movies/top250/') -html_text = browser.page_source -time.sleep(20) -soup = BeautifulSoup(html_text, 'lxml') -films = soup.find_all('div', class_='base-movie-main-info_mainInfo__ZL_u3') - -print(soup) -print(films) - -for film in films: - print(film.text) -''' -#Домашка - -from bs4 import BeautifulSoup -from selenium import webdriver -from selenium.webdriver.chrome.service import Service - -driver = Service('D:\teach\Prog\chromedriver.exe') -browser = webdriver.Chrome(service=driver) -browser.get('https://hmbrussia.ru/regional-office/') -html_code = browser.page_source -b_soup = BeautifulSoup(html_code, 'lxml') -name = b_soup.find_all('div', class_="ps-xl-3 ms-xl-3") - -print(b_soup) -print(name) - -for i in name: - print(i.text)