Skip to content

Commit

Permalink
Merge pull request egrcc#24 from yannisxu/master
Browse files Browse the repository at this point in the history
增加获取知乎 data-id 的方法来确定标识用户的唯一性
  • Loading branch information
egrcc committed Dec 19, 2015
2 parents 1a72049 + 6893172 commit c285269
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions zhihu.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,17 @@ def get_user_id(self):
else:
return user_id

def get_data_id(self):
if self.user_url == None:
print "I'm anonymous user."
return 0
else:
if self.soup == None:
self.parser()
soup = self.soup
data_id = soup.find("button", class_="zg-btn zg-btn-follow zm-rich-follow-btn")['data-id']
return data_id

def get_followees_num(self):
if self.user_url == None:
print "I'm anonymous user."
Expand Down

0 comments on commit c285269

Please sign in to comment.