Hello,
I am working on a web scraping project to get data from booking.com website.
I am able to get the name and other information, but unable to scrape the price and the tax fields. It returns None
.
Request you to please guide me how to proceed. I have pasted the code I am using below:
import requests
import re
from bs4 import BeautifulSoup
page = requests.get("https://www.booking.com/searchresults.en-us.html?label=gen173nr-1FCAEoggI46AdIM1gEaIkCiAEBmAExuAEXyAEM2AEB6AEB-AECiAIBqAIDuALa0NztBcACAQ&sid=5b86dc8f82a6b02b3062384d5f86d7d3&sb=1&src=index&src_elem=sb&error_url=https%3A%2F%2Fwww.booking.com%2Findex.html%3Flabel%3Dgen173nr-1FCAEoggI46AdIM1gEaIkCiAEBmAExuAEXyAEM2AEB6AEB-AECiAIBqAIDuALa0NztBcACAQ%3Bsid%3D5b86dc8f82a6b02b3062384d5f86d7d3%3Bsb_price_type%3Dtotal%26%3B&ss=Los+Angeles%2C+California%2C+USA&is_ski_area=&checkin_month=11&checkin_monthday=27&checkin_year=2019&checkout_month=12&checkout_monthday=2&checkout_year=2019&group_adults=2&group_children=0&no_rooms=1&b_h4u_keep_filters=&from_sf=1&ss_raw=los+angeles&ac_position=0&ac_langcode=en&ac_click_type=b&dest_id=20014181&dest_type=city&iata=LAX&place_id_lat=34.052051&place_id_lon=-118.243269&search_pageview_id=63ff7c6d7dcb0064&search_selected=true&search_pageview_id=63ff7c6d7dcb0064&ac_suggestion_list_length=5&ac_suggestion_theme_list_length=0")
#Create an instance of the BeautifulSoup class to parse our document
parser = BeautifulSoup(page.content, "lxml")
hotels = parser.select("#hotellist_inner div.sr_item.sr_item_new")
for hd in hotels:
price = hd.find('div', {'class' : 'prco-ltr-right-align-helper'})
print (price)