fb_scrape 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a990a8a5717489cc8e4a670232d99a873e705d81
4
- data.tar.gz: c2be56834af3ae1d968f62ac19d4d1aeb5d42ccb
3
+ metadata.gz: 29b58f6847d52acf4ddb42d640ec83381bfd98e2
4
+ data.tar.gz: 3515cb9e1354420f8ffd7e87ae4c175ff17ee137
5
5
  SHA512:
6
- metadata.gz: 8164a7e6ee628edf4d66b9b238a6f31a8b25acdf8872a98072bce187580f31ed8676c4688be85aca0fbcc8441d342885b051cd816678fdeaa4e62be623410e1e
7
- data.tar.gz: '08dd959a6c0b71271afc521ffd332d6d23199744ae05edc8e0d2aa8d4e1fd47b861da71beda08344628c69f2e7d20139a9a1064c404458b66e2d5eae41051a5c'
6
+ metadata.gz: 61813248a7541451c4094330fea755093473df2afc2ccf636f75348a3a5c1d32bbbdcd5f86d8669f21fe55a26b34e50b43b9fb9d0a5c73dcbe5b402f8224d7e0
7
+ data.tar.gz: 3ca16bfe693e365e770664424b2f50aa2d3faab081fa595460627e99f44d2038269dd4c50553677a0941ec9005d9334692548df744b24b0f87389d165b5ec35e
data/bin/fb_scrape CHANGED
@@ -60,6 +60,30 @@ class FBScrape::CLI < Thor
60
60
  end
61
61
  end
62
62
 
63
+ desc "export_messages", "Get all the comments for a post's shortcode"
64
+ option :limit, :required => true
65
+ option :token, :required => true
66
+ option :page_id, :required => true
67
+ option :out_file, :required => true
68
+ def export_messages
69
+ begin
70
+ # exports all a pages conversation threads to a csv file$T
71
+ client = FBScrape::Client.new(nil, options[:token], options[:page_id])
72
+ client.load_conversations(options[:limit])
73
+
74
+ client.conversations.each do |c|
75
+ c.load_messages
76
+ puts "Loading #{c.id} messages: #{c.messages.count}"
77
+ end
78
+
79
+ messages = client.conversations.collect{ |c| c.messages }.flatten
80
+ puts "Total messages #{messages.count}"
81
+
82
+ rescue ArgumentError => e
83
+ puts e.message
84
+ end
85
+ end
86
+
63
87
  end
64
88
 
65
89
  FBScrape::CLI.start(ARGV)
@@ -52,8 +52,8 @@ class FBScrape::Client
52
52
  end
53
53
 
54
54
  def load_conversations(limit=nil)
55
- load_initial_conversations
56
55
  @limit = limit if limit != @limit
56
+ load_initial_conversations
57
57
 
58
58
  while has_more_conversations? && can_load_more_conversations? do
59
59
  load_more_conversations
@@ -65,6 +65,9 @@ class FBScrape::Client
65
65
  def load_initial_conversations
66
66
  if !@loaded_initial_conversations
67
67
  url = "https://graph.facebook.com/v#{FBScrape::GRAPH_VERSION}/#{@id}/conversations?access_token=#{@token_secret}"
68
+ if is_limited?
69
+ url += "&limit=#{@limit}"
70
+ end
68
71
  load_conversations_from_url url
69
72
  @loaded_initial_conversations = true
70
73
  end
@@ -1,3 +1,3 @@
1
1
  module FBScrape
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fb_scrape
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Trevor Kimenye