Issue
Assume the div contains a name of a product:
<div _ngcontent-serverapp-c225 class="shelfProductTile-content">
in scrapy using response.css('div.shelfProductTile-content')
returns an empty list, how do you overcome this issue?
Edit:
It was claimed that Javascript web content like AngularJs and react can't be obtained by Scrapy, and it is recommended to use a tool such as Splash or Selenium. That's true, but this was not the case with my example, I tried both of these tools but didn't solve the issue. The problem was with the user-agent that should be changed. please check accepted answer below.
Thanks to all who helped.
Solution
I changed the user agent in the settings file it solved the issue:
USER_AGENT = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'
Answered By - nimop
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.