twitter-vanity-suite 0.0.2 → 0.1.0
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/bin/twitter-intersect +2 -26
- data/bin/twitter-vanity +2 -9
- data/lib-internal/common.rb +14 -0
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84f468803d3ecf4d21b55672fb369cae26690d6f
|
4
|
+
data.tar.gz: 6c2f73fa13610f2b91fcfbac8efc6571cd599a58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ebfd25e15c003a6d33885356fbfef0c65e0df9733e5ca1fb971cb8854990b1c3a9ca4ef680ba876c54b70d4bf0948cb184e64600afaaa65f09ab005d2957efe
|
7
|
+
data.tar.gz: b06c135da818f6216b763528f2b4ecd45e4b0d366eb37c51a0870053f725ad5fb8f2430a5185bcbe077a5c91d5e0e208c1742feddd559fca307a72e4b1312235
|
data/bin/twitter-intersect
CHANGED
@@ -1,29 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# Usage: twitter-intersect (<username>.following|<username>.followers)...
|
2
3
|
require_relative "../lib-internal/common"
|
3
4
|
|
4
|
-
|
5
|
-
abort "Usage: twitter-intersect (<username>.following|<username>.followers)..."
|
6
|
-
end
|
7
|
-
|
8
|
-
usage if ARGV.empty?
|
9
|
-
|
10
|
-
def all_ids(method, handle, cursor = -1)
|
11
|
-
return [] if cursor == 0
|
12
|
-
attrs = $client.send(method, handle, count: 5000, cursor: cursor).attrs
|
13
|
-
attrs[:ids] + all_ids(method, handle, attrs[:next_cursor])
|
14
|
-
end
|
15
|
-
|
16
|
-
ids = ARGV.map { |arg| arg.split(".") }.map { |handle, command|
|
17
|
-
case command
|
18
|
-
when "following"
|
19
|
-
all_ids(:friend_ids, handle)
|
20
|
-
when "followers"
|
21
|
-
all_ids(:follower_ids, handle)
|
22
|
-
else
|
23
|
-
puts "Unknown command: #{command}"
|
24
|
-
puts
|
25
|
-
usage
|
26
|
-
end
|
27
|
-
}
|
28
|
-
|
29
|
-
puts $client.users(ids.reduce(:&)).map(&:screen_name)
|
5
|
+
exec File.expand_path("twitter-algebra", __dir__), ARGV.join(" & ")
|
data/bin/twitter-vanity
CHANGED
@@ -1,14 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# Usage: twitter-vanity username
|
2
3
|
require_relative "../lib-internal/common"
|
3
4
|
|
4
|
-
abort "Usage: twitter-vanity username" if ARGV.empty?
|
5
|
-
|
6
|
-
def all_followers(username, cursor = -1)
|
7
|
-
return [] if cursor.zero?
|
8
|
-
attrs = $client.follower_ids(username, count: 5000, cursor: cursor).attrs
|
9
|
-
attrs[:ids] + all_followers(username, attrs[:next_cursor])
|
10
|
-
end
|
11
|
-
|
12
5
|
def show_ids_sorted_by_followers(ids)
|
13
6
|
users = $client.users(ids)
|
14
7
|
|
@@ -20,5 +13,5 @@ def show_ids_sorted_by_followers(ids)
|
|
20
13
|
end
|
21
14
|
|
22
15
|
username = ARGV.first
|
23
|
-
follower_ids =
|
16
|
+
follower_ids = $client.follower_ids(username).to_a
|
24
17
|
show_ids_sorted_by_followers(follower_ids)
|
data/lib-internal/common.rb
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
def usage
|
2
|
+
lines = File.readlines(File.expand_path($0)).take_while { |line| line[0] == "#" }
|
3
|
+
lines.shift # get rid of the shebang
|
4
|
+
lines.map! { |line| line[2..-1] }
|
5
|
+
puts lines
|
6
|
+
end
|
7
|
+
|
8
|
+
def usage!
|
9
|
+
usage
|
10
|
+
exit false
|
11
|
+
end
|
12
|
+
|
13
|
+
usage! if ARGV.empty?
|
14
|
+
|
1
15
|
gem "twitter", "~> 5.4"
|
2
16
|
require "twitter"
|
3
17
|
require "yaml"
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twitter-vanity-suite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charlie Somerville
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: twitter
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '5.4'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '5.4'
|
27
27
|
description: 'my personal set of command line twitter tools '
|
@@ -41,7 +41,7 @@ files:
|
|
41
41
|
- lib-internal/common.rb
|
42
42
|
homepage: https://github.com/charliesome/twitter-vanity-tools
|
43
43
|
licenses:
|
44
|
-
-
|
44
|
+
- AGPL
|
45
45
|
metadata: {}
|
46
46
|
post_install_message:
|
47
47
|
rdoc_options: []
|
@@ -49,18 +49,19 @@ require_paths:
|
|
49
49
|
- lib
|
50
50
|
required_ruby_version: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- -
|
57
|
+
- - '>='
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: '0'
|
60
60
|
requirements: []
|
61
61
|
rubyforge_project:
|
62
|
-
rubygems_version: 2.
|
62
|
+
rubygems_version: 2.0.3
|
63
63
|
signing_key:
|
64
64
|
specification_version: 4
|
65
65
|
summary: my personal set of command line twitter tools
|
66
66
|
test_files: []
|
67
|
+
has_rdoc:
|