mirror of
https://github.com/KUlishevgeniy/c22712.git
synced 2026-09-24 08:00:22 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
Generated
+1
-1
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9" project-jdk-type="Python SDK" />
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.11" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
Generated
+25
-10
@@ -4,7 +4,7 @@
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="e5615680-c090-497d-a104-1337ed85f850" name="Changes" comment="Первый коммит" />
|
||||
<list default="true" id="e5615680-c090-497d-a104-1337ed85f850" name="Changes" comment="parser" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
@@ -33,13 +33,6 @@
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"RunOnceActivity.OpenProjectViewOnStart": "true",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"WebServerToolWindowFactoryState": "false"
|
||||
}
|
||||
}</component>
|
||||
<component name="RunManager">
|
||||
<configuration name="main" type="PythonConfigurationType" factoryName="Python" nameIsGenerated="true">
|
||||
<module name="22712" />
|
||||
@@ -88,7 +81,28 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1675931967836</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="3" />
|
||||
<task id="LOCAL-00003" summary="Первый коммит">
|
||||
<created>1676532721150</created>
|
||||
<option name="number" value="00003" />
|
||||
<option name="presentableId" value="LOCAL-00003" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1676532721150</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00004" summary="Первый коммит">
|
||||
<created>1676532798232</created>
|
||||
<option name="number" value="00004" />
|
||||
<option name="presentableId" value="LOCAL-00004" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1676532798232</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00005" summary="parser">
|
||||
<created>1676934066947</created>
|
||||
<option name="number" value="00005" />
|
||||
<option name="presentableId" value="LOCAL-00005" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1676934066947</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="6" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
@@ -107,7 +121,8 @@
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="Первый коммит" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Первый коммит" />
|
||||
<MESSAGE value="parser" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="parser" />
|
||||
</component>
|
||||
<component name="XDebuggerManager">
|
||||
<breakpoint-manager>
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
from selenium.webdriver import Chrome
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.chrome.service import Service
|
||||
import time
|
||||
|
||||
# Selenium - библиотека для автоматизации действий веб браузера, скрапинга
|
||||
# запускаем браузер
|
||||
s = Service('C:\data\hrome\chromedriver.exe')
|
||||
browser = webdriver.Chrome(service=s)
|
||||
browser.get('https://www.kinopoisk.ru/lists/movies/top250/')
|
||||
time.sleep (10)#задержка для ввода капчи
|
||||
html_text = browser.page_source
|
||||
soup = BeautifulSoup(html_text, 'lxml')
|
||||
films=soup.find_all('div', class_='base-movie-main-info_mainInfo__ZL_u3')
|
||||
print (films[0].text)
|
||||
|
||||
|
||||
# Это пример парсинга. Вам необходимо спарсить 1 страницу каталога любого сайта на выбор.
|
||||
#сайты не должны повторяться
|
||||
# Спарсить необходимо только Заголовки и описание.
|
||||
@@ -1 +0,0 @@
|
||||
Тестовый вап
|
||||
@@ -1 +0,0 @@
|
||||
Ок
|
||||
@@ -1,4 +1,18 @@
|
||||
print('Hello, world!')
|
||||
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)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
from bs4 import BeautifulSoup
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.chrome.service import Service
|
||||
|
||||
s = Service('C:\Desktop\exe\chromedriver.exe')
|
||||
browser = webdriver.Chrome(service=s)
|
||||
browser.get('https://www.rftoday.ru/_vse_zagolovki2')
|
||||
html_text = browser.page_source
|
||||
soup = BeautifulSoup(html_text, 'lxml')
|
||||
infos = soup.find_all(attrs={"class": "title"})
|
||||
#print(infos[0].text) - если нужно вывести только n-ый заголовок
|
||||
for info in infos:
|
||||
print(info.text)#Вывод всех заголовков новостей страницы 1
|
||||
@@ -0,0 +1 @@
|
||||
Тестовый файл
|
||||
@@ -0,0 +1,12 @@
|
||||
from bs4 import BeautifulSoup
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.chrome.service import Service
|
||||
|
||||
s = Service("E:\data\chromedriver.exe")
|
||||
browser = webdriver.Chrome(service=s)
|
||||
browser.get("https://ria.ru/")
|
||||
html_text = browser.page_source
|
||||
soup = BeautifulSoup(html_text, 'lxml')
|
||||
news = soup.find_all('div', class_='cell cell-list')
|
||||
for new in news:
|
||||
print(new.text)
|
||||
@@ -0,0 +1 @@
|
||||
Hello World!
|
||||
@@ -0,0 +1,9 @@
|
||||
#made by dialuna (or just Diana Gasanova) <3
|
||||
import requests
|
||||
from bs4 import BeautifulSoup as bs
|
||||
URL = "https://www.kinopoisk.ru/lists/movies/top-250-2020/"
|
||||
r = requests.get(URL, timeout=10)
|
||||
soup = bs(r.text, "html.parser")
|
||||
films = soup.find_all(attrs={"class": "styles_mainTitle__IFQyZ styles_activeMovieTittle__kJdJj"})
|
||||
for film in films:
|
||||
print(film.text)
|
||||
@@ -0,0 +1 @@
|
||||
print('Hello, World!')
|
||||
@@ -1 +0,0 @@
|
||||
text
|
||||
@@ -0,0 +1,12 @@
|
||||
from bs4 import BeautifulSoup
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.chrome.service import Service
|
||||
s = Service('C:\\Users\\Dasha\\Desktop\\Progect\\chromedriver.exe')
|
||||
browser = webdriver.Chrome(service=s)
|
||||
browser.get('https://www.livelib.ru/selection/907286-vybor-redaktsii-elle-girl')
|
||||
html_text=browser.page_source
|
||||
soup=BeautifulSoup(html_text, 'lxml')
|
||||
infos = soup.find_
|
||||
films=soup.find_all(attrs={"class": "brow-book-name with-cycle"})
|
||||
for film in films:
|
||||
print(film.text)
|
||||
@@ -0,0 +1,25 @@
|
||||
# pip install selenium bs4
|
||||
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.chrome.service import Service
|
||||
from time import sleep
|
||||
|
||||
|
||||
s = Service("C:\\Users\\Alex\\PycharmProjects\\pythonProject\\chromedriver.exe")
|
||||
brow = webdriver.Chrome(service=s)
|
||||
|
||||
# brow.get("https://www.kinopoisk.ru/lists/movies/top250/")
|
||||
brow.get("https://www.revshells.com/")
|
||||
sleep(10)
|
||||
|
||||
html = brow.page_source
|
||||
|
||||
soup = BeautifulSoup(html, "lxml")
|
||||
|
||||
# films = soup.find_all(attrs={"class": "styles_mainTitle__IFQyZ styles_activeMovieTittle__kJdJj"})
|
||||
buttons = soup.find_all(attrs={"class": "list-group-item list-group-item-action"})
|
||||
|
||||
for button in buttons:
|
||||
print(button.text)
|
||||
@@ -0,0 +1 @@
|
||||
test
|
||||
@@ -0,0 +1 @@
|
||||
print("Hello, world!")
|
||||
@@ -0,0 +1 @@
|
||||
test
|
||||
@@ -0,0 +1,14 @@
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.chrome.service import Service
|
||||
s = Service("С:\DATA\ChromeDriver\chromedriver.exe")
|
||||
browser = webdriver.Chrome(service=s)
|
||||
browser.get("https://online.metro-cc.ru/category/sladosti-chipsy-sneki/shokolad-batonchiki?from=under_search&is_action=1")
|
||||
html_text = browser.page_source
|
||||
soup = BeautifulSoup(html_text, 'lxml')
|
||||
products = soup.find_all('a', class_="product-card-name reset-link catalog-2-level-product-card__name style--catalog-2-level-product-card")
|
||||
prices = soup.find_all('span', class_="product-card-prices__actual color-red")
|
||||
for product,price in zip(products, prices):
|
||||
print(f"Продукт: {product.text[3:]}Цена: {price.text}")
|
||||
print("-"*100)
|
||||
@@ -0,0 +1 @@
|
||||
hello world
|
||||
@@ -0,0 +1 @@
|
||||
eijdieid
|
||||
@@ -0,0 +1 @@
|
||||
ghg
|
||||
@@ -0,0 +1 @@
|
||||
hello!!
|
||||
@@ -1 +1,40 @@
|
||||
print("Hi, there!")
|
||||
# установи python, pip
|
||||
|
||||
# выполни эту команду: pip install selenium bs4 lxml
|
||||
# если ты используешь pycharm, то надо библиотеки ставить не в консоли(терминале), а в самом pycharm
|
||||
# для этого нажми "view" > "tool windows" > "python packages"
|
||||
# внизу в окне поиска ищи нужные библиотеки
|
||||
# когда найдешь, нажимай на нее, справа будет кнопка "install package", устанавливай, потом перезапусти pycharm
|
||||
|
||||
# найди версию своего браузера
|
||||
# напиши в гугле "скачать драйвер для <название и версия твоего браузера> selenium"
|
||||
# теперь все готово для запуска этого
|
||||
# помните, что сам сайт(который вы хотите парсить) может вас блокировать или заставлять проходить capture, из-за чего этот код ничего не выведет
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
from selenium import webdriver
|
||||
from selenium.webdriver.chrome.service import Service
|
||||
# импортируем всё нужное
|
||||
|
||||
s = Service("путь_до_драйвера") # в ковычках указываем полный путь до скаченного ранее драйвера
|
||||
# если ты на винде, то вместо знака "\" пиши "\\"
|
||||
|
||||
brow = webdriver.Chrome(service=s) # как будто создаем виртуальный браузер
|
||||
|
||||
brow.get("https://www.revshells.com/") # получаем html код сайта и другую информацию(она нам не нужна сейчас)
|
||||
|
||||
html = brow.page_source # копируем html код в переменную
|
||||
|
||||
soup = BeautifulSoup(html, "lxml") # создаем специальный парсер
|
||||
|
||||
buttons = soup.find_all(attrs={"class": "list-group-item list-group-item-action"})
|
||||
# получаем список всех html тегов, в которых есть атрибут "class", равный: "list-group-item list-group-item-action"
|
||||
|
||||
for button in buttons:
|
||||
# выводим текст каждого тега
|
||||
print(button.text)
|
||||
|
||||
# от сердца и почек
|
||||
# дарю вам питончик
|
||||
# made by perfecto
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
7y08y bp89u98 bpuih
|
||||
def print_hi(' hello')
|
||||
Reference in New Issue
Block a user