Skip to content

Instantly share code, notes, and snippets.

@ecleel
Created November 30, 2014 17:06
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 ecleel/da5d8c79b61632fdb8b1 to your computer and use it in GitHub Desktop.
Save ecleel/da5d8c79b61632fdb8b1 to your computer and use it in GitHub Desktop.
Search for apps in iTunes and Google Play and return csv files for each store.
require 'csv'
require 'json'
require 'itunes-search-api'
require 'market_bot'
query = ARGV.first
puts query
itunes = ITunesSearchAPI.search term: query, limit: 200, media: 'software', entity: 'software'
play = MarketBot::Android::SearchQuery.new(query).update.results
[itunes, play].each do |store_results|
CSV.open("#{query}_#{Time.now.to_i}.csv", "w") do |csv|
store_results.each_with_index do |hash, idx|
if idx == 0
csv << hash.keys
else
csv << hash.values
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment