问题描述
试图抓取 Glassdoor 的面试评论数据。我已经有成功提取评论日期、评论标题和评论者信息的代码,但现在试图在评论的“采访”部分下获取实际文本。这是我的代码:
def scrape_interview(review):
try:
res = review.find_element_by_class_name(' css-w00cnv.mb-std').text.strip('"')
except Exception:
logger.warning('Failed to scrape interview review')
res = np.nan
return res
我已经尝试多次检查类名是什么(当点击“继续阅读”按钮时,很确定它的“css-w00cnv.mb-std”,扩展了文本的其余部分)但由于某种原因,我仍然在我的输出中获取 nans。我也尝试在下面添加“按标签名称查找”功能,但这也不起作用。
def scrape_interview(review):
try:
res = review.find_element_by_class_name(' css-w00cnv.mb-std').find_element_by_tag_name('p').text.strip('"')
except Exception:
logger.warning('Failed to scrape interview review')
res = np.nan
return res
有没有 HTML/Python 专家可以提供帮助?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)