Skip to content

hariharan888/price_bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PriceBot

PriceBot is a command-line tool to fetch nightly prices for the given amount of days of the closest hotels within a given radius from a location. The data is fetched from various booking site APIs.

Usage

You can run PriceBot from the command line as follows:

bundle exec bin/price_bot.rb -d DAYS -l LIMIT -r RADIUS -a AREA -s SITE -f FORMAT -o OUTPUT

Options

  • -d, --days=DAYS: Number of days (default: 30)
  • -l, --limit=LIMIT: Number of listings (default: 50)
  • -r, --radius=RADIUS: Radius in kilometers (default: 2)
  • -a, --area=AREA: Area around which listings should be searched
  • -s, --site=SITE: Booking site. Options Available: ['booking.com']
  • -f, --format=FORMAT: Output format. Options Available: ['csv', 'json'] (default: 'csv')
  • -o, --output=OUTPUT_LOCATION: Output file location
  • -n, --top-n=TOP_N: If provided, will output only the top n dates with highest pricing for each listing

Example

Fetch prices for 365 days, limiting to 50 listings within a 2 km radius of New York, using booking.com, and save the output as CSV to prices.csv:

bundle exec bin/price_bot.rb -d 365 -l 50 -r 2 -a "New York" -s "booking.com" -f "csv" -o "prices.csv"

In the above request, to get only top n daily prices for each listing:

bundle exec bin/price_bot.rb -d 365 -l 50 -r 2 -a "New York" -s "booking.com" -f "csv" -o "top_prices.csv" -n 3

Fetch prices for 30 days, limiting to 50 listings within a 5 km radius of New York, using booking.com, and save the output as JSON to prices.json:

bundle exec bin/price_bot.rb -d 30 -l 50 -r 5 -a "New York" -s "booking.com" -f "json" -o "prices.json"

Running Tests

RSpec is used for testing. To run the tests, use:

bundle exec rspec

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages