网址:https://www.nature.com/articles/ncomms12114

需求:想要获得Additional Information板块下所有的文字
image.jpg
我现在的代码↓:
from lxml [color=var(--highlight-keyword)]import [color=var(--highlight-namespace)]etree[color=var(--highlight-variable)]page_text = requests.get(url=[color=var(--highlight-variable)]"https://www.nature.com/articles/ncomms12114",headers = headers).[color=var(--highlight-namespace)]text[color=var(--highlight-variable)]tree = etree.HTML(page_text)addInformatin_raw= tree.xpath([color=var(--highlight-variable)]"//h2[text()='Additional information']/..")[[color=var(--highlight-namespace)]0]addInformatin = addInformatin_raw.xpath([color=var(--highlight-variable)]'./div//text()')[[color=var(--highlight-namespace)]0]但现在得到的是:How to cite this article:(即内容不全)想问问该怎么改xpath定位 谢谢
5ab411335a946d35286002b5a46b968.jpg
举报 使用道具
| 回复

共 2 个关于本帖的回复 最后回复于 2022-2-3 22:05

2574586329 中级会员 发表于 2022-2-3 17:14:39 | 显示全部楼层
代码: 1643879626(1).png
image.png
举报 使用道具
Fuller 管理员 发表于 2022-2-3 22:05:13 | 显示全部楼层
既要调试request部分,又要调试xpath部分,太麻烦了。直接用集搜客网络爬虫软件吧
举报 使用道具
您需要登录后才可以回帖 登录 | 立即注册

精彩推荐

  • Gephi社会网络分析-马蜂窝游记文本分词并同
  • Gephi社会网络分析-基于马蜂窝游记文本以词
  • 知乎话题文本根据词语间距筛选后生成共词矩
  • 马蜂窝游记文本分词后以词语间距为筛选条件
  • 学习使用apriori算法挖掘关联关系

热门用户

GMT+8, 2024-3-28 17:00