File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -305,6 +305,9 @@ def get_all_answers(self):
305305
306306 answer_soup = BeautifulSoup (answer_list [j ])
307307
308+ if answer_soup .find ("div" , class_ = " zm-editable-content clearfix" ) == None :
309+ continue
310+
308311 author = None
309312 if answer_soup .find ("h3" , class_ = "zm-item-answer-author-wrap" ).string == u"匿名用户" :
310313 author_url = None
@@ -315,7 +318,10 @@ def get_all_answers(self):
315318 author_url = "http://www.zhihu.com" + author_tag ["href" ]
316319 author = User (author_url , author_id )
317320
318- count = answer_soup .find ("span" , class_ = "count" ).string
321+ if answer_soup .find ("span" , class_ = "count" ) == None :
322+ count = answer_soup .find ("a" , class_ = "zm-item-vote-count" ).string
323+ else :
324+ count = answer_soup .find ("span" , class_ = "count" ).string
319325 if count [- 1 ] == "K" :
320326 upvote = int (count [0 :(len (count ) - 1 )]) * 1000
321327 elif count [- 1 ] == "W" :
You can’t perform that action at this time.
0 commit comments