只返回html,不返回conten

2024-04-25 11:47:03 发布

您现在位置:Python中文网/ 问答频道 /正文

我想得到回应。。。你知道吗

<span id="BusinessDbaName" class="dataItem">TECHNO COATINGS INC</span>

scrapy回来了。。。你知道吗

******name =  [u'<span id="BusinessDbaName" class="dataItem"></span>']

也就是说,返回的是html,而不是标签中的内容。你知道吗

问题:什么会导致这种情况,我该如何修复它?你知道吗

以下是我的源代码:

import scrapy

class lniSpider(scrapy.Spider):
    name = "lni"
    allowed_domains = ["secure.lni.wa.gov"]
    start_urls = [
        "https://secure.lni.wa.gov/verify/Detail.aspx?UBI=602123234&SAW="
    ]


    def parse(self, response):
        for sel in response.xpath('//body'):

            name = sel.xpath('//*[@id="BusinessDbaName"]').extract()
            print ("******name = "), name

Tags: nameidresponsexpathclassgovscrapyspan