Questions during Python Scrapy tutorial

Asked 2 years ago, Updated 2 years ago, 130 views

Hi, everyone. I'm asking you a question because I don't know anything while studying while following the scratch tutorial. The code is as follows.

def parse(self, response):
    for href in response.css("ul.directory.dir-col > li > a::attr('href')"):
        url = response.urljoin(href.extract())
        yield scrapy.Request(url, callback=self.parse_dir_contents)

Among the above function codes, ul.directory.dir-col > li > a:attr('href') and callback=self.This is a question about parse_dir_contents.

I think it's the first css path, but I wonder if it replaced "/" with the symbol ">". And callback=self.Parse_dir_contents I don't understand this part, so I'd appreciate it if you could briefly explain the concept. ^

^

I'm searching on the Internet and looking for a manual, but I don't know. I'm asking you a question because I'm frustrated.

python scrapy

2022-09-22 12:20

1 Answers

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.