I am trying to crawl booking from a VM and I don't get the same response like the one from my local machine. The query is the following:
scrapy shell --set="ROBOTSTXT_OBEY=False" -s USER_AGENT="Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0" "https://www.booking.com/hotel/fr/le-transat-bleu.fr.html?aid=304142;label=gen173nr-1FCAEoggJCAlhYSDNiBW5vcmVmaE2IAQGYAQ3CAQp3aW5kb3dzIDEwyAEM2AEB6AEB-AELkgIBeagCAw;sid=746d95cb38d6de7fbb5a878954481e7b;all_sr_blocks=33843609_122840412_1_2_0;checkin=2019-03-17;checkout=2019-03-18;dest_id=-1424668;dest_type=city;dist=0;group_adults=1;group_children=0;hapos=1;highlighted_blocks=33843609_122840412_1_2_0;hpos=1;req_adults=1;req_children=0;room1=A%2C;sb_price_type=total;sr_order=popularity;srepoch=1550502677;srpvid=26936aca347f0334;type=total;ucfs=1&#hotelTmpl"
When I run the query from my VM, I get a response with the same URL than the one in the query while from the VM I get the generic response:
https://www.booking.com/hotel/fr/le-transat-bleu.fr.html
I must mention that before adding the USER_AGENT part I was getting the same answer even on my local machine.
Also, if I use Links, a command-line browser from the VM, I get the correct response. Hence it does not seem to come from the public IP of the VM I use.
I suspect that there is another information that booking.com
might be using to prevent the crawling of certain pages on top of the USER_AGENT
and the robot.txt
file but I don't know which one.
Local Request Headers
{b'Accept': b'text/html,application/xhtml+xml,application/xml;q=0.9,*/*; q=0.8', b'Accept-Language': b'en', b'User-Agent': b'Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0', b'Accept-Encoding': b'gzip,deflate'}
VM Request Headers
{b'Accept': [b'text/html,application/xhtml+xml,application/xml;q=0.9,*/*; q=0.8'], b'Accept-Language': [b'en'], b'User-Agent': [b'Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0'], b'Accept-Encoding': [b'gzip,deflate'], b'Cookie': [b'bkng=11UmFuZG9tSVYkc2RlIyh9Yaa29%2F3xUOLbXpFeYC4TUhBTLg%2BWRWQhTWxLpR01uuU40DSTIBsY%2F5OusQaibxVABBhdPCiYlEsnGLdmcDyD%2BtWFGVlewF8Fo59TLNV6vs0R1Ypha9MOkYUl6wASmexLrJie%2F3imTygdbEEsnB0sv0m%2B%2FJ1C6Cm42FEFBT222yQ7']}
VM Request without cookies
scrapy shell --set="COOKIES_ENABLED=False" --set="ROBOTSTXT_OBEY=False" -s USER_AGENT="Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0" "https://www.booking.com/hotel/fr/le-transat-bleu.fr.html?aid=304142;label=gen173nr-1FCAEoggJCAlhYSDNiBW5vcmVmaE2IAQGYAQ3CAQp3aW5kb3dzIDEwyAEM2AEB6AEB-AELkgIBeagCAw;sid=746d95cb38d6de7fbb5a878954481e7b;all_sr_blocks=33843609_122840412_1_2_0;checkin=2019-03-17;checkout=2019-03-18;dest_id=-1424668;dest_type=city;dist=0;group_adults=1;group_children=0;hapos=1;highlighted_blocks=33843609_122840412_1_2_0;hpos=1;req_adults=1;req_children=0;room1=A%2C;sb_price_type=total;sr_order=popularity;srepoch=1550502677;srpvid=26936aca347f0334;type=total;ucfs=1&#hotelTmpl"
VM Request Headers without cookies
{b'Accept': [b'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'], b'Accept-Language': [b'en'], b'User-Agent': [b'Mozilla/5.0 (Android 4.4; Mobile; rv:41.0) Gecko/41.0 Firefox/41.0'], b'Accept-Encoding': [b'gzip,deflate']}