need to use .items() grumble grumble

This commit is contained in:
Adrian Malacoda 2016-11-27 00:11:42 -06:00
parent b304297019
commit 9c401cbfb1

View File

@ -23,7 +23,7 @@ def scrape_index (url):
for category_element in d("div.span9 > div.row-fluid").items(): for category_element in d("div.span9 > div.row-fluid").items():
category = Category(title=category_element.find("h3").text) category = Category(title=category_element.find("h3").text)
forum.categories.append(category) forum.categories.append(category)
for board_link in category_element.find("a[href^='/forums/']"): for board_link in category_element.find("a[href^='/forums/']").items():
board = scrape_board("{}://{}{}".format(urlparts.scheme, urlparts.netloc, board_link.attr.href)) board = scrape_board("{}://{}{}".format(urlparts.scheme, urlparts.netloc, board_link.attr.href))
category.children.append(board) category.children.append(board)
print("Finished scraping all boards in category: {}".format(category.title)) print("Finished scraping all boards in category: {}".format(category.title))