python - 如何在python的Scrapy中为爬虫设置xpath
问题描述
如何为爬虫设置 xpath(我正在使用 Crapy 库)?请帮我
网址:https ://www.drugbank.vn/danh-sach/co-so-kinh-doanh
我在下面做了代码,但没有得到数据
def parse(self, response):
questions = Selector(response).xpath('//jhi-main/jhi-danh-sach')
for question in questions:
item = DrugbankItem()
item['Name'] = question.xpath('div[@class="card border-0"]/div[@class="card-body"]/div[@class="table-responsive"]/table[@class="table table-striped table-bordered"]/tbody/tr/td[1]/text()').extract_first()
yield item
谢谢!! 在此处输入图像描述
解决方案
推荐阅读
- javascript - Sourcemap 在 Sentry 中无效或不可解析
- guid - ProductCode (GUID) 用于为 AutoCAD 自动加载 DLL
- java - Tomcat 优雅关闭
- node.js - 如何在 Service 构造函数中对 Controller 进行单元测试和模拟 @InjectModel
- tomcat - Tomcat 服务器的 JVM 可用内存未返回给操作系统
- javascript - 如何打印我放入的文件的文件名在一个?
- c++ - 使用 C++ 中的 ASCII 代码将输入从小写转换为大写
- r - 如何在R中使用knn查找重要变量
- c# - 当该表中没有行时,C# sqlite 删除行不起作用
- javascript - 为什么我在我的网页上看不到我动态添加的 iron-pages 元素?