Skip to content

Instantly share code, notes, and snippets.

@Lucretiel
Created March 21, 2018 16:49
Show Gist options
  • Save Lucretiel/72a8c3e7b9c8dfc822bcd37ee9ce6151 to your computer and use it in GitHub Desktop.
Save Lucretiel/72a8c3e7b9c8dfc822bcd37ee9ce6151 to your computer and use it in GitHub Desktop.
def get_rows(selected_table):
for row in selected_table.css('tr'):
cells = row.css('td').extract()
yield tuple(cells)
def find_bge_table(response):
for table_element in response.css('table'):
table = list(get_rows(table_element))
if any(row[0] == "BGE" for row in table):
return table
raise Exception("Couldn't find BGE Table!")
class YaelSpider(Spider):
def parse(self, response):
table = find_bge_table(response)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment