fluent-plugin-twitter 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +1 -0
- data/README.md +2 -1
- data/fluent-plugin-twitter.gemspec +2 -1
- data/lib/fluent/plugin/in_twitter.rb +14 -6
- data/lib/fluent/plugin/out_twitter.rb +6 -6
- metadata +18 -2
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -46,9 +46,10 @@ $ sudo td-agent-gem install fluent-plugin-twitter
|
|
46
46
|
oauth_token YOUR_OAUTH_TOKEN # Required
|
47
47
|
oauth_token_secret YOUR_OAUTH_TOKEN_SECRET # Required
|
48
48
|
tag input.twitter.sampling # Required
|
49
|
-
timeline tracking # Required (tracking or sampling or userstream)
|
49
|
+
timeline tracking # Required (tracking or sampling or location or userstream)
|
50
50
|
keyword Ruby,Python # Optional (keyword is priority than follow_ids)
|
51
51
|
follow_ids 14252,53235 # Optional (integers, not screen names)
|
52
|
+
locations 31.110283, 129.431631, 45.619283, 145.510175 # Optional (bounding boxes; first pair specifies longitude/latitude of southwest corner)
|
52
53
|
lang ja,en # Optional
|
53
54
|
output_format nest # Optional (nest or flat or simple[default])
|
54
55
|
</source>
|
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "fluent-plugin-twitter"
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.5.0"
|
7
7
|
s.authors = ["Kentaro Yoshida"]
|
8
8
|
s.email = ["y.ken.studio@gmail.com"]
|
9
9
|
s.homepage = "https://github.com/y-ken/fluent-plugin-twitter"
|
@@ -15,6 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.require_paths = ["lib"]
|
16
16
|
|
17
17
|
s.add_development_dependency "rake"
|
18
|
+
s.add_development_dependency "test-unit", ">= 3.1.0"
|
18
19
|
s.add_runtime_dependency "fluentd", ">= 0.10.46"
|
19
20
|
s.add_runtime_dependency "twitter", ">= 5.0.0"
|
20
21
|
s.add_runtime_dependency "tweetstream", ">= 2.6.1"
|
@@ -1,17 +1,23 @@
|
|
1
1
|
module Fluent
|
2
2
|
class TwitterInput < Fluent::Input
|
3
|
-
TIMELINE_TYPE = %w(userstream sampling tracking)
|
3
|
+
TIMELINE_TYPE = %w(userstream sampling location tracking)
|
4
4
|
OUTPUT_FORMAT_TYPE = %w(nest flat simple)
|
5
5
|
Plugin.register_input('twitter', self)
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
7
|
+
# To support Fluentd v0.10.57 or earlier
|
8
|
+
unless method_defined?(:router)
|
9
|
+
define_method("router") { Fluent::Engine }
|
10
|
+
end
|
11
|
+
|
12
|
+
config_param :consumer_key, :string, :secret => true
|
13
|
+
config_param :consumer_secret, :string, :secret => true
|
14
|
+
config_param :oauth_token, :string, :secret => true
|
15
|
+
config_param :oauth_token_secret, :string, :secret => true
|
11
16
|
config_param :tag, :string
|
12
17
|
config_param :timeline, :string
|
13
18
|
config_param :keyword, :string, :default => nil
|
14
19
|
config_param :follow_ids, :string, :default => nil
|
20
|
+
config_param :locations, :string, :default => nil
|
15
21
|
config_param :lang, :string, :default => nil
|
16
22
|
config_param :output_format, :string, :default => 'simple'
|
17
23
|
config_param :flatten_separator, :string, :default => '_'
|
@@ -61,6 +67,8 @@ module Fluent
|
|
61
67
|
client.track(@keyword)
|
62
68
|
elsif @timeline == 'tracking' && @follow_ids
|
63
69
|
client.follow(@follow_ids)
|
70
|
+
elsif @timeline == 'location' && @locations
|
71
|
+
client.locations(@locations)
|
64
72
|
elsif @timeline == 'sampling' && @keyword.nil? && @follow_ids.nil?
|
65
73
|
client.sample
|
66
74
|
elsif @timeline == 'userstream'
|
@@ -113,7 +121,7 @@ module Fluent
|
|
113
121
|
record.store('user_time_zone', status[:user][:time_zone])
|
114
122
|
record.store('user_lang', status[:user][:lang])
|
115
123
|
end
|
116
|
-
|
124
|
+
router.emit(@tag, Engine.now, record)
|
117
125
|
end
|
118
126
|
|
119
127
|
def hash_flatten(record, prefix = nil)
|
@@ -1,12 +1,12 @@
|
|
1
1
|
class Fluent::TwitterOutput < Fluent::Output
|
2
2
|
Fluent::Plugin.register_output('twitter', self)
|
3
3
|
|
4
|
-
config_param :consumer_key, :string
|
5
|
-
config_param :consumer_secret, :string
|
6
|
-
config_param :oauth_token, :string, :default => nil
|
7
|
-
config_param :oauth_token_secret, :string, :default => nil
|
8
|
-
config_param :access_token, :string, :default => nil
|
9
|
-
config_param :access_token_secret, :string, :default => nil
|
4
|
+
config_param :consumer_key, :string, :secret => true
|
5
|
+
config_param :consumer_secret, :string, :secret => true
|
6
|
+
config_param :oauth_token, :string, :default => nil, :secret => true
|
7
|
+
config_param :oauth_token_secret, :string, :default => nil, :secret => true
|
8
|
+
config_param :access_token, :string, :default => nil, :secret => true
|
9
|
+
config_param :access_token_secret, :string, :default => nil, :secret => true
|
10
10
|
|
11
11
|
def initialize
|
12
12
|
super
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-twitter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-11-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: test-unit
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 3.1.0
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 3.1.0
|
30
46
|
- !ruby/object:Gem::Dependency
|
31
47
|
name: fluentd
|
32
48
|
requirement: !ruby/object:Gem::Requirement
|