Created
October 4, 2012 12:01
-
-
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
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
| 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Good to see you're still coding!