本文整理匯總了Python中extractor.Extractor.extract_comment_body方法的典型用法代碼示例。如果您正苦於以下問題:Python Extractor.extract_comment_body方法的具體用法?Python Extractor.extract_comment_body怎麽用?Python Extractor.extract_comment_body使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類extractor.Extractor
的用法示例。
在下文中一共展示了Extractor.extract_comment_body方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: extract_comments
# 需要導入模塊: from extractor import Extractor [as 別名]
# 或者: from extractor.Extractor import extract_comment_body [as 別名]
def extract_comments(self):
if self.has_soup():
comments = self.soup.find_all("div", class_="comment") or []
for comment in comments:
extractor = Extractor(comment)
author = extractor.extract_comment_author_user_name()
post_url = "" #this needs to be set with the post in scope
date = extractor.extract_comment_date()
score = extractor.extract_comment_score()
body = extractor.extract_comment_body()
self.comments.append(Comment(
author=author,
post_url=post_url,
date=date,
score=score,
body=body
))
return self.comments