for i in range(60):

        index='vol1-5338-p'+str(i+2)
        final_url=os.path.join('file:///C:\Users\Administrator\AppData\Roaming\Tencent\QQTempSys\%W@GJ$ACOF(TYDYECOKVDYB.pnghttp://m.1kkk.com/',index)
        driver.get(final_url)
        print(final_url)
        try:
            img_path = driver.find_element_by_xpath(".//img[@id='cp_img']")
        except NoSuchElementException:
            print('下载完毕')
            driver.quit()
            sys.exit()              #捕获异常后退出程序
        img_url = img_path.get_attribute('src')  # get_attribute('src') 获取src内的内容




举报 使用道具
| 回复

共 1 个关于本帖的回复 最后回复于 2021-8-6 09:38

gz51837844 管理员 发表于 2021-8-6 09:38:44 | 显示全部楼层
可以打开Gooseeker网络爬虫数据管家的规则调试界面, 直接查看xpath是否可以定位到节点, 也可以自动生成xpath
QQ截图20210806093752.png
举报 使用道具
您需要登录后才可以回帖 登录 | 立即注册

精彩推荐

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

热门用户

GMT+8, 2024-3-29 01:18