hyena 0.0.1
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.
- data/README +0 -0
- data/bin/hyena +33 -0
- data/lib/hyena.rb +38 -0
- metadata +63 -0
data/README
ADDED
File without changes
|
data/bin/hyena
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
#! /usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'hyena'
|
5
|
+
require 'optparse'
|
6
|
+
require 'ostruct'
|
7
|
+
|
8
|
+
options = OpenStruct.new
|
9
|
+
|
10
|
+
opts = OptionParser.new do |opts|
|
11
|
+
opts.banner = "usage: hyena [options]"
|
12
|
+
opts.on("-u", "--username USERNAME", "Your twitter account username.") do |username|
|
13
|
+
options.username << username
|
14
|
+
end
|
15
|
+
opts.on("-p", "--password PASSWORD", "Your twitter account password.") do |password|
|
16
|
+
options.password << password
|
17
|
+
end
|
18
|
+
opts.on("-l", "--limit", Integer, "Max number of follows (default 50).") do |follows|
|
19
|
+
options.follows = follows || 50
|
20
|
+
end
|
21
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
22
|
+
puts opts
|
23
|
+
exit
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
users = []
|
28
|
+
ARGV.each do |user|
|
29
|
+
users << user
|
30
|
+
end
|
31
|
+
|
32
|
+
session = Hyena.new(options.username, options.password)
|
33
|
+
session.follow(users, options.follows)
|
data/lib/hyena.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'twitter'
|
2
|
+
|
3
|
+
class Hyena
|
4
|
+
attr_accessor :keywords, :account
|
5
|
+
|
6
|
+
def initialize (username, password)
|
7
|
+
@account = Twitter::Base.new(username, password)
|
8
|
+
end
|
9
|
+
|
10
|
+
def contains (followers, user)
|
11
|
+
followers.each do |follower|
|
12
|
+
if user == follower
|
13
|
+
return true
|
14
|
+
end
|
15
|
+
end
|
16
|
+
false
|
17
|
+
end
|
18
|
+
|
19
|
+
def follow (users, max)
|
20
|
+
num_follows = rand(max / 2, max)
|
21
|
+
followers = account.follower_ids
|
22
|
+
|
23
|
+
i = 0
|
24
|
+
users.each do |user|
|
25
|
+
if not contains(followers, user)
|
26
|
+
account.follow(user)
|
27
|
+
i = i + 1
|
28
|
+
sleep(rand(1..3))
|
29
|
+
end
|
30
|
+
|
31
|
+
if (i == num_follows)
|
32
|
+
break
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
puts "Successfully followed #{i} users."
|
37
|
+
end
|
38
|
+
end
|
metadata
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hyena
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Robert Seaton
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-10-27 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: twitter
|
16
|
+
requirement: &70251857453440 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.7.2
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70251857453440
|
25
|
+
description: ! ' Hyena follows people on Twitter so you don''t have to.
|
26
|
+
|
27
|
+
'
|
28
|
+
email: seatonr@dupage.edu
|
29
|
+
executables:
|
30
|
+
- hyena
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- lib/hyena.rb
|
35
|
+
- bin/hyena
|
36
|
+
- README
|
37
|
+
homepage:
|
38
|
+
licenses:
|
39
|
+
- BSD
|
40
|
+
post_install_message:
|
41
|
+
rdoc_options: []
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
none: false
|
46
|
+
requirements:
|
47
|
+
- - ! '>='
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 1.8.1
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
requirements:
|
57
|
+
- a gentle disposition
|
58
|
+
rubyforge_project:
|
59
|
+
rubygems_version: 1.8.5
|
60
|
+
signing_key:
|
61
|
+
specification_version: 3
|
62
|
+
summary: Manages your Twitter followers.
|
63
|
+
test_files: []
|