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 e2abd95 commit 368459b
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions scraper.py
Expand Up @@ -32,21 +32,24 @@ def scrape_data():
h2 = soup.find("h2")
e_name.append(h2.text.strip())

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"}).find("tbody").find_all("tr")

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"}).find(
"tbody").find_all("tr")

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

try:
try:

f1.append(fighters[0].text.strip())
f2.append(fighters[1].text.strip())

f1.append(fighters[0].text.strip())
f2.append(fighters[1].text.strip())
except IndexError:

except IndexError:
f1.append("null")
f2.append("null")

f1.append("null")
f2.append("null")
continue

continue

return None

Expand Down

0 comments on commit 368459b

Please sign in to comment.