Created
November 30, 2014 17:06
-
-
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.
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 '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