我要在我的抓取程序中添加第二个蜘蛛,并且我只在这个蜘蛛中抓取一个URL,所以我想知道是否有一种方法可以仅在start_urls内设置我的代理和用户代理,或者是否有办法放在蜘蛛里面吗?
class LoginSpider(scrapy.Spider):
name = 'login_spider'
start_urls = ['https://www.starcitygames.com/myaccount/']
def parse(self, response):
# login and scrape website
答案 0 :(得分:0)
class LoginSpider(scrapy.Spider):
name = 'login_spider'
my_urls = ['https://www.starcitygames.com/myaccount/']
def start_requests(self):
for url self.my_urls:
yield Request(url, meta={'proxy': 'YOUR PROXY HERE'})
def parse(self, response):
# login and scrape website