scrapy python从类名中删除URL
我是新来的 我想从类中获取所有URL,例如,我有以下代码scrapy python从类名中删除URL,python,scrapy,Python,Scrapy,我是新来的 我想从类中获取所有URL,例如,我有以下代码 #i did something like this but i did not work myURLs = [] class CoolSpider(CrawlSpider): name = 'cool' allowed_domains = ['phooky.com'] start_urls = ['https://www.phooky.com/'] rules = (Rule(LinkExtractor(), callback=&quo
#i did something like this but i did not work
myURLs = []
class CoolSpider(CrawlSpider):
name = 'cool'
allowed_domains = ['phooky.com']
start_urls = ['https://www.phooky.com/']
rules = (Rule(LinkExtractor(), callback="parse_obj", follow=True),)
def parse_obj(self, response):
item = response.url
myURLs.append(item)
print(item)
最后,当我放置print(myurl)时,什么也没有显示
当然,我在命令行中运行它
谢谢大家你们把打印(MyURL)
放在哪里了?我想如果你把它放在parse_obj
中,它会随着列表的增长而打印整个列表。你把print(myurl)
放在哪里了?我想如果你把它放在parse_obj
中,它会随着列表的增长而打印整个列表。