bin/fb_scrape in fb_scrape-0.0.9 vs bin/fb_scrape in fb_scrape-0.0.10

- old
+ new

@@ -1,10 +1,11 @@ #!/usr/bin/env ruby require 'fb_scrape' require 'thor' require 'json' +require 'csv' class FBScrape::CLI < Thor desc "version", "Get the version of the client running" def version @@ -76,9 +77,18 @@ puts "Loading #{c.id} messages: #{c.messages.count}" end messages = client.conversations.collect{ |c| c.messages }.flatten puts "Total messages #{messages.count}" + + CSV.open(options[:out_file], "w") do |w| + w << ["message_id", "conversation_id", "from", "text", "is_reply", "created_at"] + + messages.each do |m| + w << [m.id, m.conversation_id, m.from_name, m.text, m.is_reply?, m.created_at ] + end + end + rescue ArgumentError => e puts e.message end end