Skip to content

Instantly share code, notes, and snippets.

@ThibaudLamothe
Last active July 12, 2022 12:27
Show Gist options
  • Save ThibaudLamothe/615ecf256e2f007c648e72e7c5ac3727 to your computer and use it in GitHub Desktop.
Save ThibaudLamothe/615ecf256e2f007c648e72e7c5ac3727 to your computer and use it in GitHub Desktop.
# Select the first announcement from the previous list of 20
hotel = hotels[0]
# Get main information
title = hotel.css('a ::attr(aria-label)').extract_first()
url_link = hotel.css('::attr(href)').extract_first()
url_img = hotel.css('img ::attr(src)').extract_first()
type_of_room = hotel.css('div._b14dlit ::text').extract_first()
# Get tag information
additionnal_info = hotel.css('div._kqh46o ::text').extract()
additionnal_info = [i for i in additionnal_info if i not in [' · ']]
# Get rating information
rating = hotel.css('span._10fy1f8 ::text').extract_first()
nb_comment = hotel.css('span._a7a5sx ::text').extract()
nb_comment = nb_comment[1]
# Is it a airbnb "superhost" ?
superhost = hotel.css('div._ufoy4t::text').extract()
superhost = 'SUPERHOST' in superhost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment