Найти - Пользователи
Полная версия: Парсер сайта Whoscored ?
Начало » Центр помощи » Парсер сайта Whoscored ?
1
olegshtompel
Добрый вечер! Помогите спарсить данные ( Phyton) с данного сайта Whoscored нужно всего два столбца игрок и рейтинг. Подскажите пожалуйста ?
AD0DE412
https://beautiful-soup-4.readthedocs.io/en/latest/#
ps удали дубликат темы
olegshtompel
 from selenium import webdriver
from selenium.webdriver.gekodriver.service import Service
from webdriver_manager.geko import GekoDriverManager
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
import pandas as pd
url = 'https://www.whoscored.com/Matches/1549539/LiveStatistics/England-Premier-League-2021-2022-Brentford-Arsenal'
s = Service(GekoDriverManager().install())
driver = webdriver.Geko(service=s)
# web driver goes to page
driver.get(url)
WebDriverWait(driver, 15).until(
        EC.presence_of_element_located((By.ID, 'player-table-statistics-body'))
    )
Players_list = []
Player_rating = []
for nme in driver.find_elements(By.CSS_SELECTOR, 'a.player-link span.iconize.iconize-icon-left'):
    Players_list.append(nme.text)
for rat in driver.find_elements(By.CSS_SELECTOR, 'td.rating'):
    Player_rating.append(rat.text)
data = {'name': Players_list, 'rating': Player_rating}
df = pd.DataFrame(data)
print(df)
df.to_csv('brentford-arsenal.csv')
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB