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:
@@ -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