# -*- coding: utf-8 -*-
"""
Created on 2021-02-08 16:06:12
---------
@summary:
---------
@author: Boris
"""

import feapder
from items import *


class TestSpider2(feapder.Spider):
    def start_requests(self):
        for i in range(100):
            yield feapder.Request("https://www.baidu.com#{}".format(i))

    def parse(self, request, response):
        title = response.xpath("//title/text()").extract_first()  # 取标题
        item = spider_data_item.SpiderDataItem()  # 声明一个item
        item.title = title  # 给item属性赋值
        yield item  # 返回item， item会自动批量入库
