instafavs 0.0.1 → 0.0.2
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.textile +30 -0
- data/bin/instafavs +14 -5
- data/instafavs.gemspec +1 -13
- data/lib/instafavs/version.rb +1 -1
- metadata +4 -16
- data/README +0 -1
data/README.textile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
h1. instafavs
|
2
|
+
|
3
|
+
by Brad Bollenbach
|
4
|
+
|
5
|
+
instafavs extracts links from favorited tweets and sends them to Instapaper.
|
6
|
+
|
7
|
+
h2. Install
|
8
|
+
|
9
|
+
<pre>
|
10
|
+
$ instafavs --configure
|
11
|
+
Twitter username: 30sleeps
|
12
|
+
Instapaper username: bradb@30sleeps.com
|
13
|
+
Instapaper password: somepass
|
14
|
+
Configuration saved successfully.
|
15
|
+
</pre>
|
16
|
+
|
17
|
+
The install instafavs into your crontab:
|
18
|
+
|
19
|
+
<pre>
|
20
|
+
$ crontab -e
|
21
|
+
</pre>
|
22
|
+
|
23
|
+
To check your Twitter feed every 5 minutes for new favorites:
|
24
|
+
|
25
|
+
<pre>
|
26
|
+
# This is what works for my rvm-based setup!
|
27
|
+
*/5 * * * * bash --login -c instafavs
|
28
|
+
</pre>
|
29
|
+
|
30
|
+
Please email any feedback or bug reports to "bradb@30sleeps.com":mailto:bradb@30sleeps.com.
|
data/bin/instafavs
CHANGED
@@ -6,8 +6,11 @@ require File.join(File.expand_path(File.dirname(__FILE__)), "..", "lib", "instaf
|
|
6
6
|
|
7
7
|
$verbose = false
|
8
8
|
|
9
|
-
def verbose(msg)
|
10
|
-
|
9
|
+
def verbose(msg, level=1)
|
10
|
+
if $verbose
|
11
|
+
puts "* #{msg}" if level == 1
|
12
|
+
puts " -> #{msg}" if level == 2
|
13
|
+
end
|
11
14
|
end
|
12
15
|
|
13
16
|
def send_links_from_fav_tweets_to_instapaper
|
@@ -16,15 +19,21 @@ def send_links_from_fav_tweets_to_instapaper
|
|
16
19
|
seen_fav_ids = Set.new
|
17
20
|
favorites = Twitter.favorites(Instafavs::Config.twitter_username)
|
18
21
|
verbose("found #{favorites.size} latest favorites for user #{Instafavs::Config.twitter_username}")
|
19
|
-
favorites.
|
22
|
+
favorites.each_with_index do |f, i|
|
20
23
|
seen_fav_ids << f.id_str
|
21
|
-
|
24
|
+
if Instafavs::Config.last_seen_fav_ids.include?(f.id_str)
|
25
|
+
verbose("skipping ##{i + 1} '#{f.text}', already seen")
|
26
|
+
next
|
27
|
+
end
|
28
|
+
verbose("scanning #{f.text} for urls to extract")
|
22
29
|
f.text.scan(%r{http(?:s?)://[^ ]+}).each do |url|
|
30
|
+
verbose("found #{url}, sending to instapaper", 2)
|
23
31
|
HTTParty.post("https://www.instapaper.com/api/add",
|
24
32
|
:query => { :url => url, :username => Instafavs::Config.instapaper_username,
|
25
33
|
:password => Instafavs::Config.instapaper_password })
|
26
34
|
end
|
27
35
|
end
|
36
|
+
verbose("updating config with #{seen_fav_ids.size} latest seen ids")
|
28
37
|
Instafavs::Config.update_last_seen_fav_ids!(seen_fav_ids)
|
29
38
|
end
|
30
39
|
|
@@ -46,7 +55,7 @@ $verbose = options[:verbose]
|
|
46
55
|
|
47
56
|
if options[:configure]
|
48
57
|
Instafavs::Config.save!(collect_config_info)
|
49
|
-
puts "
|
58
|
+
puts "Configuration saved successfully."
|
50
59
|
else
|
51
60
|
send_links_from_fav_tweets_to_instapaper
|
52
61
|
end
|
data/instafavs.gemspec
CHANGED
@@ -15,19 +15,7 @@ Gem::Specification.new do |s|
|
|
15
15
|
s.post_install_message = <<SETUP
|
16
16
|
********************************************************************************
|
17
17
|
|
18
|
-
To
|
19
|
-
|
20
|
-
1. Run instafavs --configure. Fill in the info required.
|
21
|
-
|
22
|
-
2. Install instafavs into your crontab, e.g.
|
23
|
-
|
24
|
-
$ crontab -e
|
25
|
-
|
26
|
-
to check your Twitter feed every 5 minutes for new favorites, add this line:
|
27
|
-
|
28
|
-
*/5 * * * * /path/to/instafavs
|
29
|
-
|
30
|
-
Please email any feedback or bug reports to bradb@30sleeps.com.
|
18
|
+
To install instafavs, please see docs at: https://github.com/bradb/instafavs
|
31
19
|
|
32
20
|
********************************************************************************
|
33
21
|
SETUP
|
data/lib/instafavs/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 2
|
9
|
+
version: 0.0.2
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Brad Bollenbach
|
@@ -59,7 +59,7 @@ extra_rdoc_files: []
|
|
59
59
|
files:
|
60
60
|
- .gitignore
|
61
61
|
- Gemfile
|
62
|
-
- README
|
62
|
+
- README.textile
|
63
63
|
- Rakefile
|
64
64
|
- bin/instafavs
|
65
65
|
- instafavs.gemspec
|
@@ -72,19 +72,7 @@ licenses: []
|
|
72
72
|
post_install_message: |
|
73
73
|
********************************************************************************
|
74
74
|
|
75
|
-
To
|
76
|
-
|
77
|
-
1. Run instafavs --configure. Fill in the info required.
|
78
|
-
|
79
|
-
2. Install instafavs into your crontab, e.g.
|
80
|
-
|
81
|
-
$ crontab -e
|
82
|
-
|
83
|
-
to check your Twitter feed every 5 minutes for new favorites, add this line:
|
84
|
-
|
85
|
-
*/5 * * * * /path/to/instafavs
|
86
|
-
|
87
|
-
Please email any feedback or bug reports to bradb@30sleeps.com.
|
75
|
+
To install instafavs, please see docs at: https://github.com/bradb/instafavs
|
88
76
|
|
89
77
|
********************************************************************************
|
90
78
|
|
data/README
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Extract links from favorited tweets and send them to Instapaper.
|