Skip to content

Commit

Permalink
fix bugs about parsing uid
Browse files Browse the repository at this point in the history
  • Loading branch information
ResolveWang committed Oct 19, 2017
1 parent e8ddbcf commit 157c6da
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions page_parse/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ def get_weibo_info(each, html):
wb_data = WeiboData()

user_cont = each.find(attrs={'class': 'face'})
user_href = user_cont.find('a').get('href', '')
if not user_href:
parser.warning('Failed to get user id')
usercard = user_cont.find('img').get('usercard', '')
if not usercard:
parser.warning('Failed to get user card')
return None
wb_data.uid = parse_url(user_href).path[3:]
wb_data.uid = usercard.split('&')[0][3:]

try:
wb_data.weibo_id = each.find(attrs={'class': 'WB_screen'}).find('a').get('action-data')[4:]
Expand Down

0 comments on commit 157c6da

Please sign in to comment.