instafavs 0.0.4 → 0.0.5

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.
Files changed (3) hide show
  1. data/bin/instafavs +10 -7
  2. data/lib/instafavs/version.rb +1 -1
  3. metadata +2 -2
@@ -16,12 +16,15 @@ end
16
16
  def send_links_from_fav_tweets_to_instapaper
17
17
  Instafavs::Config.load!
18
18
 
19
- last_update_run_at = Instafavs::Config.last_update_run_at
20
- this_update_run_at = Time.now.utc
21
- twitter_username = Instafavs::Config.twitter_username
22
- favourites = Instafavs.new_favourites_in_period(twitter_username, last_update_run_at, this_update_run_at)
23
- verbose("found #{favourites.size} latest favourites for user #{twitter_username}")
19
+ seen_fav_ids = Set.new
20
+ favourites = Twitter.favorites(Instafavs::Config.twitter_username)
21
+ verbose("found #{favourites.size} latest favourites for user #{Instafavs::Config.twitter_username}")
24
22
  favourites.each_with_index do |f, i|
23
+ seen_fav_ids << f.id_str
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
25
28
  verbose("scanning #{f.text} for urls to extract")
26
29
  f.text.scan(%r{http(?:s?)://[^ ]+}).each do |url|
27
30
  verbose("found #{url}, sending to instapaper", 2)
@@ -30,8 +33,8 @@ def send_links_from_fav_tweets_to_instapaper
30
33
  :password => Instafavs::Config.instapaper_password })
31
34
  end
32
35
  end
33
- verbose("updating last run at timestamp")
34
- Instafavs::Config.last_update_run_at!(this_update_run_at)
36
+ verbose("updating config with #{seen_fav_ids.size} latest seen ids")
37
+ Instafavs::Config.update_last_seen_fav_ids!(seen_fav_ids)
35
38
  end
36
39
 
37
40
  def collect_config_info
@@ -1,3 +1,3 @@
1
1
  module Instafavs
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 4
9
- version: 0.0.4
8
+ - 5
9
+ version: 0.0.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Brad Bollenbach