Skip to content

Instantly share code, notes, and snippets.

@jmburges
Created October 4, 2012 12:01
Show Gist options
  • Select an option

  • Save jmburges/3833178 to your computer and use it in GitHub Desktop.

Select an option

Save jmburges/3833178 to your computer and use it in GitHub Desktop.
Initial script to parse Kayak feed for finding flights under a certain price from a certain airport on a certain airline
require 'feedzirra'
feed = Feedzirra::Feed.fetch_and_parse("http://www.kayak.com/h/rss/buzz?code=#{ARGV[0]}")
feed.entries.each do |entry|
if /^.+\sfound\stoday/.match(entry.title) && /^.+\son\s#{ARGV[1]}\sfound/.match(entry.title)
from = entry.title.scan(/^([A-Z]{3})/).first.last
to = entry.title.scan(/^[A-Z]{3} to ([A-Z]{3})/).first.last
cost = entry.title.scan(/^.+ \$(\d+)/).first.last.to_i
if cost<ARGV[2].to_i
puts "#{from} to #{to} for #{cost}"
end
end
end
@jmburges

jmburges commented Oct 4, 2012

Copy link
Copy Markdown
Author

This was my initial proof of concept script. I working on converting this to a full fledged rails app

@jmburges

jmburges commented Oct 4, 2012

Copy link
Copy Markdown
Author

oh and the arguments are

From Airport Code
Airline ("Delta","US Airways")
price

@mickeyreiss

Copy link
Copy Markdown

Good to see you're still coding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment