Search code examples
pythonweb-scrapingscrapyscrapy-shell

scrapy can not follow full link


scrapy shell ""https://www.winemag.com/wine-ratings/2/"
response 

however I get

2019-02-19 14:16:35 [scrapy.extensions.telnet] INFO: Telnet console listening on 127.0.0.1:6023 2019-02-19 14:16:35 [scrapy.core.engine] INFO: Spider opened 2019-02-19 14:16:35 [scrapy.core.engine] DEBUG: Crawled (200) <GET https://www.winemag.com/robots.txt> (referer: None) 2019-02-19 14:16:35 [scrapy.downloadermiddlewares.redirect] DEBUG: Redirecting (301) to <GET http://www.winemag.com/wine-ratings> from <GET https://www.winemag.com/wine-ratings/2/> 2019-02-19 14:16:35 [scrapy.downloadermiddlewares.redirect] DEBUG: Redirecting (301) to <GET https://www.winemag.com/wine-ratings> from <GET http://www.winemag.com/wine-ratings> 2019-02-19 14:16:35 [scrapy.downloadermiddlewares.redirect] DEBUG: Redirecting (301) to <GET https://www.winemag.com/wine-ratings/> from <GET https://www.winemag.com/wine-ratings> 2019-02-19 14:16:35 [scrapy.core.engine] DEBUG: Crawled (200) <GET https://www.winemag.com/wine-ratings/> (referer: None)

<200 https://www.winemag.com/wine-ratings/>

I can't figure out why is it not obtaining the full link, could someone provide me a suggestion please.


Solution

  • I've found the answer. I had to specify the USER_AGENT in the settings file.