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 e0d3a1d commit 0e08b1c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions scraper.py
Expand Up @@ -13,6 +13,7 @@
f1 = []
f2 = []
all_rows = []
fighters = []


def scrape_data():
Expand All @@ -34,12 +35,10 @@ def scrape_data():
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"
all_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 all_rows:

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

try:

Expand Down Expand Up @@ -78,3 +77,4 @@ def create_df():
df.to_sql('data', conn, if_exists='replace')
print('Db successfully constructed and saved')
conn.close()

0 comments on commit 0e08b1c

Please sign in to comment.