tweetlr 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +7 -3
- data/lib/processors/photo_service.rb +6 -2
- data/lib/tweetlr.rb +1 -1
- data/spec/processors/photo_services_processor_spec.rb +5 -0
- data/spec/spec_helper.rb +5 -0
- data/tweetlr.gemspec +1 -1
- metadata +18 -18
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# tweetlr
|
2
2
|
|
3
|
+
<a href="http://travis-ci.org/#!/5v3n/tweetlr">![travis-ci](http://travis-ci.org/5v3n/tweetlr.png)</a>
|
4
|
+
|
3
5
|
tweetlr crawls twitter for a given term, extracts photos out of the collected tweets' short urls and posts the images to tumblr.
|
4
6
|
|
5
|
-
|
7
|
+
There is a new [tweetlr "as-a-service"](http://tweetlr.5v3n.com) where you can easily create an account without having to know or host anything.
|
6
8
|
|
7
9
|
## Supported image sharing services
|
8
10
|
|
@@ -16,7 +18,9 @@ tweetlr supports
|
|
16
18
|
- twitter / photobucket
|
17
19
|
- path.com
|
18
20
|
- t.co shortened links to pictures
|
19
|
-
- every service accessible via embed.ly (see [photo providers](http://embed.ly/providers))
|
21
|
+
- every photo service accessible via embed.ly (see [photo providers](http://embed.ly/providers))
|
22
|
+
- plus every service that delivers a thumbnail via embed.ly
|
23
|
+
|
20
24
|
|
21
25
|
## Installation
|
22
26
|
|
@@ -48,7 +52,7 @@ whitelist: #twitter accounts in that list will have their tweets published immed
|
|
48
52
|
|
49
53
|
Make sure you put the configuration file in it's proper place as mentioned above, then:
|
50
54
|
|
51
|
-
start/stop tweetlr using `tweetlr start`/`tweetlr stop`. Run `tweetlr` without arguments for a list of options concerning the daemon's options.
|
55
|
+
start/stop tweetlr using `tweetlr start`/`tweetlr stop`. Run `tweetlr` without arguments for a list of options concerning the daemon's options.
|
52
56
|
|
53
57
|
For a easy to modify working example, check out the [tweetlr_demo](http://github.com/5v3n/tweetlr_demo).
|
54
58
|
|
@@ -56,8 +56,12 @@ module Processors
|
|
56
56
|
def self.image_url_embedly(link_url, key)
|
57
57
|
response = Processors::Http::http_get_json "http://api.embed.ly/1/oembed?key=#{key}&url=#{link_url}"
|
58
58
|
log.debug "embedly call: http://api.embed.ly/1/oembed?key=#{key}&url=#{link_url}"
|
59
|
-
if response
|
60
|
-
|
59
|
+
if response
|
60
|
+
if response['type'] == 'photo'
|
61
|
+
image_url = response['url']
|
62
|
+
else
|
63
|
+
image_url = response['thumbnail_url']
|
64
|
+
end
|
61
65
|
end
|
62
66
|
image_url
|
63
67
|
end
|
data/lib/tweetlr.rb
CHANGED
@@ -15,6 +15,11 @@ describe Processors::PhotoService do
|
|
15
15
|
:twitter_pics => 'http://t.co/FmyBGfyY'
|
16
16
|
}
|
17
17
|
end
|
18
|
+
it "finds images in embedly results that are not explicitly marked as 'Photo' via the response's 'thumbnail_url' attribute" do
|
19
|
+
stub_embedly_no_photo
|
20
|
+
link = Processors::PhotoService::find_image_url 'im mocked anyways'
|
21
|
+
link.should == 'http://s3-media4.ak.yelpcdn.com/bphoto/py1D5XEyOHcOcg6GJD3SEQ/l.jpg'
|
22
|
+
end
|
18
23
|
it "should find a picture's url from the supported services" do
|
19
24
|
@links.each do |service,link|
|
20
25
|
send "stub_#{service}"
|
data/spec/spec_helper.rb
CHANGED
@@ -403,3 +403,8 @@ def stub_embedly
|
|
403
403
|
Curl::Easy.any_instance.stub(:body_str).and_return %|{"provider_url": "http://www.flickr.com/", "description": "Lady GaGa", "title": "Lady GaGa", "url": "http://farm6.static.flickr.com/5204/5319200155_c966f67dc3.jpg", "author_name": "mjcom18", "height": 468, "width": 307, "thumbnail_url": "http://farm6.static.flickr.com/5204/5319200155_c966f67dc3_t.jpg", "thumbnail_width": 66, "version": "1.0", "provider_name": "Flickr", "cache_age": 3600, "type": "photo", "thumbnail_height": 100, "author_url": "http://www.flickr.com/photos/57795463@N05/"}|
|
404
404
|
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
405
405
|
end
|
406
|
+
|
407
|
+
def stub_embedly_no_photo
|
408
|
+
Curl::Easy.any_instance.stub(:body_str).and_return %|{"provider_url": "http://www.yelp.de/", "description": "Fotos von Kopiba \u2013 #coffeediary \u2013 Hamburg", "title": "#coffeediary Yelp", "url": "http://www.yelp.de/biz_photos/wB1uHl_VnEbn7tqigTZKTQ?pt=biz_photo&ref=twitter&select=py1D5XEyOHcOcg6GJD3SEQ", "thumbnail_width": 298, "thumbnail_url": "http://s3-media4.ak.yelpcdn.com/bphoto/py1D5XEyOHcOcg6GJD3SEQ/l.jpg", "version": "1.0", "provider_name": "Yelp", "type": "link", "thumbnail_height": 400}|
|
409
|
+
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
410
|
+
end
|
data/tweetlr.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tweetlr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-12-
|
12
|
+
date: 2011-12-28 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: daemons
|
16
|
-
requirement: &
|
16
|
+
requirement: &2157402720 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2157402720
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: eventmachine
|
27
|
-
requirement: &
|
27
|
+
requirement: &2157402220 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2157402220
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: curb
|
38
|
-
requirement: &
|
38
|
+
requirement: &2157401780 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2157401780
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: json
|
49
|
-
requirement: &
|
49
|
+
requirement: &2157401360 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2157401360
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: nokogiri
|
60
|
-
requirement: &
|
60
|
+
requirement: &2157400940 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *2157400940
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
|
-
requirement: &
|
71
|
+
requirement: &2157400520 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *2157400520
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rspec
|
82
|
-
requirement: &
|
82
|
+
requirement: &2157400100 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,10 +87,10 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *2157400100
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rdoc
|
93
|
-
requirement: &
|
93
|
+
requirement: &2157399680 !ruby/object:Gem::Requirement
|
94
94
|
none: false
|
95
95
|
requirements:
|
96
96
|
- - ! '>='
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
version: '0'
|
99
99
|
type: :development
|
100
100
|
prerelease: false
|
101
|
-
version_requirements: *
|
101
|
+
version_requirements: *2157399680
|
102
102
|
description: tweetlr crawls twitter for a given term, extracts photos out of the collected
|
103
103
|
tweets' short urls and posts the images to tumblr.
|
104
104
|
email: sven.kraeuter@gmail.com
|