dbrady-twitterlost 0.0.3
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/MIT-LICENSE +22 -0
- data/README +59 -0
- data/bin/twitterlost +44 -0
- data/twitter_sample.yml +3 -0
- metadata +64 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2008 David Brady twitterlost@shinybit.com
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person
|
4
|
+
obtaining a copy of this software and associated documentation
|
5
|
+
files (the "Software"), to deal in the Software without
|
6
|
+
restriction, including without limitation the rights to use,
|
7
|
+
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
copies of the Software, and to permit persons to whom the
|
9
|
+
Software is furnished to do so, subject to the following
|
10
|
+
conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be
|
13
|
+
included in all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
+
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
+
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
+
OTHER DEALINGS IN THE SOFTWARE.
|
data/README
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
README
|
2
|
+
|
3
|
+
twitterlost is a command-line tool to keep track of your Twitter
|
4
|
+
followers. Each time it runs it shows you the new and lost followers
|
5
|
+
since the last time it ran.
|
6
|
+
|
7
|
+
Description
|
8
|
+
-----------
|
9
|
+
|
10
|
+
Keep track of your twitter followers, see who has unfollowed
|
11
|
+
you. Sadly it will not tell you why (but it was probably because of
|
12
|
+
something you did).
|
13
|
+
|
14
|
+
Installation
|
15
|
+
------------
|
16
|
+
|
17
|
+
1. Install the gem.
|
18
|
+
|
19
|
+
2. mkdir ~/.twitterlost (or run twitterlost once and it will be
|
20
|
+
created for you)
|
21
|
+
|
22
|
+
3. Edit ~/.twitterlost/twitter.yml with the following information:
|
23
|
+
|
24
|
+
---
|
25
|
+
:login: $USERNAME
|
26
|
+
:password: $PASSWORD
|
27
|
+
|
28
|
+
That's it. The first time you run twitterlost it will see all your
|
29
|
+
followers as new; after that it will only report changes.
|
30
|
+
|
31
|
+
License
|
32
|
+
-------
|
33
|
+
|
34
|
+
Twitterlost is released under the MIT license. Take it, play with it,
|
35
|
+
do whatever you want with it, keep this version free.
|
36
|
+
|
37
|
+
Motivation
|
38
|
+
----------
|
39
|
+
|
40
|
+
Why did I write Twitterlost? Because I think Twitterless.com is a good
|
41
|
+
service wrapped around a brilliant idea, but I didn't want to give
|
42
|
+
them my Twitter login and password. If you don't see a problem with
|
43
|
+
giving them your login credentials, then by all means use their
|
44
|
+
service; it's better than this hack. They'll send you regular email
|
45
|
+
updates and such, where twitterlost has to be run by hand.
|
46
|
+
|
47
|
+
Known Issues
|
48
|
+
------------
|
49
|
+
|
50
|
+
twitterlost uses the Twitter API to retrieve your list of
|
51
|
+
friends. This is returned in chunks of 100. If you have more than 100
|
52
|
+
followers, twitterlost must make multiple calls to Twitter. EACH CALL
|
53
|
+
counts towards Twitter's 70-calls-per-hour limit. If you have many
|
54
|
+
followers and are running a polling Twitter client, Twitter may slap
|
55
|
+
you withan "overloaded" message. If this happens to twitterlost, it
|
56
|
+
interprets this as the end of your friends list, which means it will
|
57
|
+
report all those people as lost friends. They'll come back the next
|
58
|
+
time you run twitterlost.
|
59
|
+
|
data/bin/twitterlost
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# twitterlost--keep track of unsubscribed followers. Still just a 0.0.1 proof of concept. YMMV.
|
3
|
+
# David Brady dbrady@shinybit.com http://twitter.com/chalain
|
4
|
+
#
|
5
|
+
# TODO: Consider a sqlite database instead of flat files, track new/lost dates
|
6
|
+
# TODO: Clean up ugly while loop
|
7
|
+
|
8
|
+
# !!!IMPORTANT NOTE!!! requires twitter4r >= 0.3.1 and as of
|
9
|
+
# 2008-10-11 rubyforge version is 0.3.0. Make sure you have github
|
10
|
+
# gem sources, then gem install mbbx6spp-twitter4r
|
11
|
+
require 'rubygems'
|
12
|
+
require 'twitter'
|
13
|
+
require 'yaml'
|
14
|
+
|
15
|
+
base_dir = File.expand_path("~/.twitterlost/")
|
16
|
+
|
17
|
+
# Make sure the dir exists
|
18
|
+
FileUtils.mkdir_p(base_dir)
|
19
|
+
|
20
|
+
cfg = YAML::load_file( File.join(base_dir, "twitter.yml") )
|
21
|
+
|
22
|
+
old_followers = IO.readlines(File.join(base_dir, "followers.txt")).map {|line| line.strip }.sort rescue []
|
23
|
+
|
24
|
+
@client = Twitter::Client.new :login => cfg[:login], :password => cfg[:password]
|
25
|
+
|
26
|
+
def followers_page(page)
|
27
|
+
@client.my :followers, :page => page
|
28
|
+
end
|
29
|
+
|
30
|
+
# Get all your followers. Loop is still kludgy.
|
31
|
+
p,f,followers=0,[],[]
|
32
|
+
followers += f.map { |u| u.screen_name } while (f=followers_page(p+=1)).any?
|
33
|
+
followers.sort!
|
34
|
+
|
35
|
+
lost_followers = old_followers - followers
|
36
|
+
new_followers = followers - old_followers
|
37
|
+
|
38
|
+
puts "You have #{followers.size} followers. Since the last time this program was run you lost #{lost_followers.size} followers and gained #{new_followers.size} new ones."
|
39
|
+
|
40
|
+
puts lost_followers.map { |u| "LOST: #{u}" }
|
41
|
+
puts new_followers.map { |u| "NEW: #{u}" }
|
42
|
+
|
43
|
+
File.new(File.join(base_dir, "followers.txt"), "w").puts followers
|
44
|
+
File.new(File.join(base_dir, "lost.txt"), "a").puts lost_followers if lost_followers.any?
|
data/twitter_sample.yml
ADDED
metadata
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: dbrady-twitterlost
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Brady
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-01-05 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: mbbx6spp-twitter4r
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.3.1
|
23
|
+
version:
|
24
|
+
description: Twitterlost - keep track of your twitter followers lost and gained
|
25
|
+
email: github@shinybit.com
|
26
|
+
executables:
|
27
|
+
- twitterlost
|
28
|
+
extensions: []
|
29
|
+
|
30
|
+
extra_rdoc_files: []
|
31
|
+
|
32
|
+
files:
|
33
|
+
- twitter_sample.yml
|
34
|
+
- bin/twitterlost
|
35
|
+
- README
|
36
|
+
- MIT-LICENSE
|
37
|
+
has_rdoc: false
|
38
|
+
homepage: http://github.com/dbrady/twitterlost
|
39
|
+
post_install_message:
|
40
|
+
rdoc_options: []
|
41
|
+
|
42
|
+
require_paths:
|
43
|
+
- lib
|
44
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: "0"
|
49
|
+
version:
|
50
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: "0"
|
55
|
+
version:
|
56
|
+
requirements: []
|
57
|
+
|
58
|
+
rubyforge_project:
|
59
|
+
rubygems_version: 1.2.0
|
60
|
+
signing_key:
|
61
|
+
specification_version: 2
|
62
|
+
summary: Twitterlost - keep track of your twitter followers lost and gained
|
63
|
+
test_files: []
|
64
|
+
|