Skip to content

Commit

Permalink
Update scraper.py
Browse files Browse the repository at this point in the history
  • Loading branch information
rdmaloney committed Aug 11, 2019
1 parent bb419de commit ddd4670
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions scraper.py
Expand Up @@ -28,20 +28,19 @@ def scrape_data():

for link in all_links:
print(f"Now currently scraping link: {link}")

data = requests.get(link)
soup = BeautifulSoup(data.text, 'html.parser')
time.sleep(1)

h2 = soup.find("h2")
e_name.append(h2.text.strip())

rows = soup.find_all('table', {"class": "b-fight-details__table b-fight-details__table_style_margin-top b-fight-details__table_type_event-details js-fight-table"})

for row in rows:
fights_table = soup.find('table', {"class": "b-fight-details__table b-fight-details__table_style_margin-top b-fight-details__table_type_event-details js-fight-table"})

rows = fights_table.find_all('tr', {"class": "b-fight-details__table-row b-fight-details__table-row__hover js-fight-details-click"

for row in rows:


fighters = row.find_all('a', {"href": re.compile("http://ufcstats.com/fighter-details")})
fighters = rows.find_all('a', {"href": re.compile("http://ufcstats.com/fighter-details")})

try:
f1.append(fighters[0].text.strip())
Expand Down

0 comments on commit ddd4670

Please sign in to comment.