Created
March 21, 2018 16:49
-
-
Save Lucretiel/72a8c3e7b9c8dfc822bcd37ee9ce6151 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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