Follow to the redirect links in scrapy

2019-04-25 09:38发布

How i can set this? i have written handle_httpstatus_list = [301, 302, 303], but scrapy does not follow to the new links, it just has begun to save empty files of pages.

P.S. English is not my native language. Exuse me for that.

标签: python scrapy
2条回答
一夜七次
2楼-- · 2019-04-25 10:16

Scrapy does handle redirects by default, meaning that the RedirectMiddleware is activated in the DOWNLOADER_MIDDLEWARES setting and the REDIRECT_ENABLED setting is set to True.

查看更多
手持菜刀,她持情操
3楼-- · 2019-04-25 10:17

You will also need to mention dont_redirect = true in your request as:

meta = {'dont_redirect': True, "handle_httpstatus_list" : [301, 302, 303]}

Regards

查看更多
登录 后发表回答