Skip to content

Instantly share code, notes, and snippets.

@vlad-shatskyi
Created July 8, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vlad-shatskyi/21cb6e526d8e397c4da4 to your computer and use it in GitHub Desktop.
Save vlad-shatskyi/21cb6e526d8e397c4da4 to your computer and use it in GitHub Desktop.
module Scraper::BookingCom
class RoomBot < BotBase
include Scraper::ScrapingCommon
HTTP_RESPONSE_VALIDATORS = [
:nil_response, :status_404, :status_200, :html,
->(url, resp) { raise(CustomExceptions::InvalidUrlError, url) if resp.uri.path.include?("searchresults") }
]
def scrape
page = get(url)
validate_http_response!(url, page)
HotelEntities::HotelPage.new(page).rates
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment