Skip to content

Instantly share code, notes, and snippets.

@vlad-shatskyi
Last active August 29, 2015 14:24
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/bcd5fdacc740435f704c to your computer and use it in GitHub Desktop.
Save vlad-shatskyi/bcd5fdacc740435f704c 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
module Scraper::BookingCom
class RoomBot < BotBase
include Scraper::ScrapingCommon
def scrape
RateBot.new(smth).scrape.rates
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment