配置解析每个域的规则?

时间:2018-08-20 14:24:17

标签: python scrapy

示例:

def start_requests(self):
    urls = ['www.google.com', 'www.stackoverflow.com' ...] # only google or stackoverflow
    for url in urls:
        if url.startswith("www.google.com"): 
            yield Request(url, callback=self.parse)
        elif url.startswith("www.stackoverflow.com"): 
            yield Request(url, callback=self.parse_stack)
def parse(self,response): ~
def parse_stack(self,response): ~

我想为每个域制定解析规则。有什么推荐的解析技术吗?

0 个答案:

没有答案