tweet_watch 0.2.2.pre → 0.2.3.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tweet_watch/cli.rb +5 -2
- data/lib/tweet_watch/monitor.rb +8 -4
- data/lib/tweet_watch/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e73e51822890ec3d5333a74fd2dcd25cb433394
|
4
|
+
data.tar.gz: 0255ff95f17eef5ae53c56c156646a98134997f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f811bbb8d2c24a4b53c93ed7d3d2e517fee9e8e966b85562fdbf17c6d514ac5cc2699923ca11fe404aca6a4caa9b2cdbbd5496480d7bd76fe14f763b99c1ad93
|
7
|
+
data.tar.gz: feb5ef50129e4dd00ab490ac032143d76619a78662de7ad80567df0d0679b81aa54a0deb24ce22c295add93690e76aab599705c4f88fe732f8b0ada5a452da77
|
data/lib/tweet_watch/cli.rb
CHANGED
@@ -102,9 +102,12 @@ module TweetWatch
|
|
102
102
|
end
|
103
103
|
|
104
104
|
desc "monitor", "Monitors target tweeters tweets and provided account timelines."
|
105
|
-
|
105
|
+
option :interval, aliases: "-i", desc: "Time delay between each monitoring run. Default = 15 mins."
|
106
|
+
option :initial_tweet_history, aliases: "-hn", desc: "When started Monitor will collect 200 tweets by defaul for each tweeter."
|
107
|
+
option :timeline_count, aliases: "-n", desc: "For each monitor run, how many tweets should be collected. 200 by default is also the max."
|
108
|
+
def monitor
|
106
109
|
load_config(options)
|
107
|
-
m = TweetWatch::Monitor.new
|
110
|
+
m = TweetWatch::Monitor.new(options)
|
108
111
|
m.run
|
109
112
|
end
|
110
113
|
|
data/lib/tweet_watch/monitor.rb
CHANGED
@@ -9,7 +9,11 @@ module TweetWatch
|
|
9
9
|
include TweetWatch::Client
|
10
10
|
include TweetWatch::Utils
|
11
11
|
|
12
|
-
def initialize
|
12
|
+
def initialize(options = {})
|
13
|
+
@options = {interval: (15*60),
|
14
|
+
initial_tweet_history: 200,
|
15
|
+
timeline_count: 200}.merge(options)
|
16
|
+
|
13
17
|
@new_tweeter_tweets = 0
|
14
18
|
|
15
19
|
if TweetWatch.config.tweeters.empty?
|
@@ -37,7 +41,7 @@ module TweetWatch
|
|
37
41
|
|
38
42
|
@new_tweeter_tweets = 0
|
39
43
|
|
40
|
-
sleep(
|
44
|
+
sleep(@options[:interval])
|
41
45
|
self.run
|
42
46
|
end
|
43
47
|
|
@@ -48,7 +52,7 @@ module TweetWatch
|
|
48
52
|
|
49
53
|
c = client({screen_name: account.screen_name})
|
50
54
|
time = Time.now.utc
|
51
|
-
timeline = c.home_timeline({count:
|
55
|
+
timeline = c.home_timeline({count: @options[:timeline_count]})
|
52
56
|
|
53
57
|
file = CSV.open("account_timeline.csv", "a+")
|
54
58
|
unless File.size("account_timeline.csv") > 0
|
@@ -66,7 +70,7 @@ module TweetWatch
|
|
66
70
|
puts "collecting @#{tweeter} tweets..."
|
67
71
|
time = Time.now.utc
|
68
72
|
|
69
|
-
opts = {count:
|
73
|
+
opts = {count: @options[:initial_tweet_history]}
|
70
74
|
if @tweeter_state[tweeter]
|
71
75
|
opts[:since_id] = @tweeter_state[tweeter]
|
72
76
|
end
|
data/lib/tweet_watch/version.rb
CHANGED