Scrapy 我写了一个错误的蜘蛛,却找不到,谁能更正代码?

Scrapy 我写了一个错误的蜘蛛,却找不到,谁能更正代码?,scrapy,Scrapy,蜘蛛代码是错误的。我创建了一个恶魔项目,但它不起作用,请检查我的vs代码截图&我不知道我所有的蜘蛛代码和问题 import scrapy class EmailSpider(scrapy.Spider): name='Email' start_url = [ 'http://jsjy.114chn.com/' ] def parse(self,response): for Email in response.xpath("//

蜘蛛代码是错误的。我创建了一个恶魔项目,但它不起作用,请检查我的vs代码截图&我不知道我所有的蜘蛛代码和问题

import scrapy

class EmailSpider(scrapy.Spider):
    name='Email'

    start_url = [
        'http://jsjy.114chn.com/'
    ]

    def parse(self,response):
        for Email in response.xpath("//span[@id='lblEmail']"):
            yiel{
                'email_text': Email.xpath(".//span[@id='lblEmail_text']/p").extract_first()
            }

         next_page= response.xpath("//li[@class='next']/a/@href").extract_first()
         if next_page is not None:
             next_page_link= response.urljoin(next_page)
             yield scrapy.Request(url=next_page_link, callback=self.parse)  

缩进和
屈服
功能有问题。还进行了一些代码样式更正:

import scrapy


class EmailSpider(scrapy.Spider):
    name = 'Email'
    start_url = ['http://jsjy.114chn.com/']

    def parse(self, response):
        for email in response.xpath("//span[@id='lblEmail']"):
            yield {
                'email_text': email.xpath(".//span[@id='lblEmail_text']/p").get()
            }

        next_page = response.xpath("//li[@class='next']/a/@href").get()
        if next_page:
            yield scrapy.Request(response.urljoin(next_page))
但由于页面上没有任何
#lblEmail
元素,因此此爬行器将不会输出任何内容