快捷导航
网址: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部分,太麻烦了。直接用集搜客网络爬虫软件吧
举报 使用道具
您需要登录后才可以回帖 登录 | 立即注册

精彩推荐

  • 对共词关系求协方差矩阵后再用Girvan-Newma
  • 社区发现算法Girvan-Newman(GN)是否能应用
  • 使用GooSeeker分词和Gephi进行中文文本分析
  • Gephi社会网络分析-网络图的统计
  • 范文:亚运短视频对杭州城市形象的建构研究

热门用户

GMT+8, 2023-6-2 15:33