c.py 403 字节
Newer Older
梦想橡皮擦's avatar
梦想橡皮擦 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
import scrapy
from scrapy.selector import Selector
from scrapy.http import HtmlResponse


class CSpider(scrapy.Spider):
    name = 'c'
    allowed_domains = ['csdn.net']
    start_urls = ['https://blog.csdn.net/rank/list/column']

    def parse(self, response):
        response = HtmlResponse(url=self.start_urls[0])

        ret = Selector(response=response).xpath("//title").get()
        print(ret)