我的xpath很好,但我对scrapy一无所知

2024-05-29 00:20:57 发布

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

我试着用一页废纸。我发现了带有FireXpath(一个firefox插件)的xpath,看起来不错。但是我没有结果。在

我的python程序如下所示:

#!/usr/bin/python -tt
# -*- coding: utf-8 -*-

from scrapy.selector import Selector
from scrapy.contrib.spiders import CrawlSpider
from datetime import datetime
from scrapy.spider import BaseSpider

class robtex(BaseSpider):
    # Crawling Start
    CrawlSpider.started_on = datetime.now()
    # CrawlSpider
    name = 'robtex'

    DOWNLOAD_DELAY = 3
    start_urls = [ "https://www.whois.com/en/advisory/dns/com/stackoverflow/whois.html"]


    def parse(self, response):
        # Selector
        sel = Selector(response)
        print sel.xpath(".//*[@id='datawhois']/div[2]/table[3]/tbody/tr[3]/td[2]/a/text()").extract()

如何修复?在

提前谢谢。在


Tags: fromimportcomdatetimeresponsewhoisselectorxpath

热门问题