remove blank node in ratings

This commit is contained in:
hillerliao
2020-04-23 22:21:46 +08:00
parent 5cb773b6a9
commit 7ebde9b02b

View File

@@ -12,9 +12,10 @@ def ctx(category=''):
item['description'] = item['title'] = stock.upper() + '的评级:' + ', '.join(post.css('td::text').extract()) item['description'] = item['title'] = stock.upper() + '的评级:' + ', '.join(post.css('td::text').extract())
return item return item
url = f'{domain}/stock/{category}/ratings' url = f'{domain}/stock/{category}/ratings'
tree = fetch(url, headers=DEFAULT_HEADERS) tree = fetch(url, headers=DEFAULT_HEADERS)
posts = tree.css('tr') posts = tree.css('tbody tr')
items = list(map(parse, posts)) items = list(map(parse, posts))
column_title = tree.css('title::text').extract_first() column_title = tree.css('title::text').extract_first()