use*_*000 9 python redirect scrapy web-scraping
我正在使用Scrapy抓取一些页面.我从excel表中获取start_urls,我需要将url保存在项目中.
class abc_Spider(BaseSpider):
name = 'abc'
allowed_domains = ['abc.com']
wb = xlrd.open_workbook(path + '/somefile.xlsx')
wb.sheet_names()
sh = wb.sheet_by_name(u'Sheet1')
first_column = sh.col_values(15)
start_urls = first_column
handle_httpstatus_list = [404]
def parse(self, response):
item = abcspiderItem()
item['url'] = response.url
Run Code Online (Sandbox Code Playgroud)
问题是url被重定向到其他url(因此在响应url中提供了其他内容).如何获取我从excel获得的原始URL?