Created
July 8, 2015 14:26
-
-
Save vlad-shatskyi/21cb6e526d8e397c4da4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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