Heim  >  Fragen und Antworten  >  Hauptteil

python - Warum kann die Schleife bei Verwendung von Scrapy nur die erste Seite abrufen?

class OnlineSpider(scrapy.Spider):
name = "online"
allowed_domains = ["www.onlinedown.net"]
start_urls = ['http://www.onlinedown.net/new/android/','http://www.onlinedown.net/new/ios/','http://www.onlinedown.net/new/windows/']#
model = Model('onlinedown')

def start_request(self):
    for url in self.start_urls:
        for x in range(1, 100):
            detail_url = url + str(x) + '.html'
            print detail_url
            yield scrapy.Request(detail_url, callback = self.parse)
            

Es gibt 35 Elemente pro Seite und das Ergebnis sind 105 Elemente. Warum ist das.

黄舟黄舟2711 Tage vor678

Antworte allen(2)Ich werde antworten

  • PHP中文网

    PHP中文网2017-05-18 11:01:02

    parse函数怎么写的啊

    Antwort
    0
  • 漂亮男人

    漂亮男人2017-05-18 11:01:02

    你的parse方法呢?

    Antwort
    0
  • StornierenAntwort