tweetlr 0.1.9 → 0.1.10
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/lib/processors/photo_service.rb +3 -1
- data/lib/tweetlr.rb +1 -1
- data/spec/processors/photo_services_processor_spec.rb +6 -1
- data/spec/spec_helper.rb +156 -137
- data/tweetlr.gemspec +1 -1
- metadata +18 -18
@@ -40,7 +40,9 @@ module Processors
|
|
40
40
|
|
41
41
|
#extract the image of a path.com pic
|
42
42
|
def self.image_url_path(link_url)
|
43
|
-
|
43
|
+
service_url = link_url_redirect link_url #follow possible redirects
|
44
|
+
link_url = service_url if service_url #if there's no redirect, service_url will be nil
|
45
|
+
image_url = nil
|
44
46
|
html_response = Processors::Http::http_get link_url
|
45
47
|
html_doc = Nokogiri::HTML.parse(html_response.body_str)
|
46
48
|
if html_doc
|
data/lib/tweetlr.rb
CHANGED
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe Processors::PhotoService do
|
4
4
|
before :each do
|
5
5
|
@links = {
|
6
|
-
:path => '
|
6
|
+
:path => 'http://path.com/p/KQd57',
|
7
7
|
:instagram => "http://instagr.am/p/DzCWn/",
|
8
8
|
:twitpic => "http://twitpic.com/449o2x",
|
9
9
|
:yfrog => "http://yfrog.com/h4vlfp",
|
@@ -28,6 +28,11 @@ describe Processors::PhotoService do
|
|
28
28
|
check_pic_url_extraction service if [:instagram,:picplz,:yfrog,:imgly,:not_listed].index service
|
29
29
|
end
|
30
30
|
end
|
31
|
+
it "finds path images for redirected moments as well" do
|
32
|
+
stub_path_redirected
|
33
|
+
url = Processors::PhotoService::find_image_url @links[:path]
|
34
|
+
url.should == 'https://s3-us-west-1.amazonaws.com/images.path.com/photos2/f90fd831-43c3-48fd-84cb-5c3bae52957a/2x.jpg'
|
35
|
+
end
|
31
36
|
it "should not crash if embedly fallback won't find a link" do
|
32
37
|
stub_bad_request
|
33
38
|
url = Processors::PhotoService::find_image_url "http://mopskopf"
|
data/spec/spec_helper.rb
CHANGED
@@ -11,6 +11,162 @@ def check_pic_url_extraction(service)
|
|
11
11
|
image_url.should =~ Processors::PhotoService::PIC_REGEXP
|
12
12
|
end
|
13
13
|
|
14
|
+
def stub_tumblr
|
15
|
+
Curl::Easy.any_instance.stub(:response_code).and_return 201
|
16
|
+
Curl::Easy.any_instance.stub(:header_str).and_return %|HTTP/1.1 201 Created
|
17
|
+
Date: Sun, 13 Nov 2011 16:56:02 GMT
|
18
|
+
Server: Apache
|
19
|
+
P3P: CP="ALL ADM DEV PSAi COM OUR OTRo STP IND ONL"
|
20
|
+
Vary: Accept-Encoding
|
21
|
+
X-Tumblr-Usec: D=2600406
|
22
|
+
Content-Length: 11
|
23
|
+
Connection: close
|
24
|
+
Content-Type: text/plain; charset=utf-8
|
25
|
+
|
26
|
+
|
|
27
|
+
Curl::Easy.any_instance.stub(:body_str).and_return %|12742797055|
|
28
|
+
Curl::Easy.stub!(:http_post).and_return Curl::Easy.new
|
29
|
+
stub_instagram
|
30
|
+
end
|
31
|
+
|
32
|
+
def stub_twitter
|
33
|
+
Curl::Easy.any_instance.stub(:body_str).and_return %|{"results":[{"from_user_id_str":"220650275","profile_image_url":"http://a2.twimg.com/profile_images/668619338/9729_148876458070_505518070_2628895_7160219_n_normal.jpg","created_at":"Sat, 16 Jul 2011 23:20:01 +0000","from_user":"LoMuma","id_str":"92372947855093760","metadata":{"result_type":"recent"},"to_user_id":null,"text":"Need to stop procrastinating! 5 quizzes and personal responses due tomorrow... #fail","id":92372947855093760,"from_user_id":220650275,"geo":null,"iso_language_code":"en","to_user_id_str":null,"source":"<a href="http://twitter.com/">web</a>"},{"from_user_id_str":"129718556","profile_image_url":"http://a2.twimg.com/profile_images/1428268221/twitter_normal.png","created_at":"Sat, 16 Jul 2011 23:20:01 +0000","from_user":"priiislopes","id_str":"92372947846692865","metadata":{"result_type":"recent"},"to_user_id":null,"text":"Esse jogo do Flu foi uma vergonha. Se ele fez o melhor dele no brasileiro semana passada, hj fez o pior de todos os tempos. #Fail","id":92372947846692865,"from_user_id":129718556,"geo":null,"iso_language_code":"pt","to_user_id_str":null,"source":"<a href="http://twitter.com/">web</a>"},{"from_user_id_str":"259930166","profile_image_url":"http://a3.twimg.com/profile_images/1425221519/foto_normal.jpg","created_at":"Sat, 16 Jul 2011 23:20:00 +0000","from_user":"YamiiG4","id_str":"92372943132303360","metadata":{"result_type":"recent"},"to_user_id":null,"text":"vaya que eran 2 minutos..#FAIL!","id":92372943132303360,"from_user_id":259930166,"geo":null,"iso_language_code":"es","to_user_id_str":null,"source":"<a href="http://www.tweetdeck.com" rel="nofollow">TweetDeck</a>"},{"from_user_id_str":"321557905","profile_image_url":"http://a0.twimg.com/profile_images/1445672626/profile_normal.png","created_at":"Sat, 16 Jul 2011 23:20:00 +0000","from_user":"JasWafer_FFOE","id_str":"92372941379088384","metadata":{"result_type":"recent"},"to_user_id":null,"text":"RT @eye_OFBEHOLDER: RT @JasWafer_FFOE #Oomf said that he'll NEVER eat pussy! O.o --#FAIL","id":92372941379088384,"from_user_id":321557905,"geo":null,"iso_language_code":"en","to_user_id_str":null,"source":"<a href="http://twidroyd.com" rel="nofollow">Twidroyd for Android</a>"},{"from_user_id_str":"279395613","profile_image_url":"http://a0.twimg.com/profile_images/1334871419/lnnsquare_normal.jpg","created_at":"Sat, 16 Jul 2011 23:19:59 +0000","from_user":"LanguageNewsNet","id_str":"92372940640890881","metadata":{"result_type":"recent"},"to_user_id":null,"text":"Questioning the Inca Paradox: Did the civilization behind Machu Picchu really fail to develop a written la... http://tinyurl.com/5sfos23","id":92372940640890881,"from_user_id":279395613,"geo":null,"iso_language_code":"en","to_user_id_str":null,"source":"<a href="http://twitterfeed.com" rel="nofollow">twitterfeed</a>"}],"max_id":92372947855093760,"since_id":0,"refresh_url":"?since_id=92372947855093760&q=+fail","next_page":"?page=2&max_id=92372947855093760&rpp=5&q=+fail","results_per_page":5,"page":1,"completed_in":0.022152,"since_id_str":"0","max_id_str":"92372947855093760","query":"+fail"}|
|
34
|
+
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
35
|
+
end
|
36
|
+
|
37
|
+
def stub_twitter_pics
|
38
|
+
Curl::Easy.any_instance.stub(:body_str).and_return %|{"url": "http://pic.twitter.com/stubbedpic.jpg:large"}|
|
39
|
+
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
40
|
+
end
|
41
|
+
|
42
|
+
def stub_instagram
|
43
|
+
Curl::Easy.any_instance.stub(:body_str).and_return %|{"provider_url": "http://instagram.com/", "title": "Curse you tweets. See what you have done to me?!!!", "url": "http://distillery.s3.amazonaws.com/media/2011/05/02/d25df62b9cec4a138967a3ad027d055b_7.jpg", "author_name": "loswhit", "height": 612, "width": 612, "version": "1.0", "author_url": "http://instagram.com/", "provider_name": "Instagram", "type": "photo"}|
|
44
|
+
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
45
|
+
end
|
46
|
+
|
47
|
+
#instagram syntax but without a valid image link
|
48
|
+
def stub_no_image_link
|
49
|
+
Curl::Easy.any_instance.stub(:body_str).and_return %|{"url":"http://noimageurl"}|
|
50
|
+
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
51
|
+
end
|
52
|
+
|
53
|
+
def stub_bad_request
|
54
|
+
Curl::Easy.any_instance.stub(:body_str).and_return %|<html><title>400: Bad Request - Invalid URL format http://mopskopf</title><body>400: Bad Request - Invalid URL format http://mopskopf</body></html>|
|
55
|
+
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
56
|
+
end
|
57
|
+
|
58
|
+
def stub_utf8_response
|
59
|
+
Curl::Easy.any_instance.stub(:body_str).and_return %|√∫ƒ® are inhabitänts of utf-8 wonderländ.|
|
60
|
+
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
61
|
+
end
|
62
|
+
|
63
|
+
def stub_yfrog
|
64
|
+
Curl::Easy.any_instance.stub(:body_str).and_return %|{"version":"1.0","provider_name":"yFrog","provider_url":"http:\/\/yfrog.com","thumbnail_url":"http:\/\/yfrog.com\/h4vlfp:small","width":1210,"height":894,"type":"image","url":"http:\/\/img616.yfrog.com\/img616\/16\/vlf.png"}|
|
65
|
+
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
66
|
+
end
|
67
|
+
|
68
|
+
def stub_picplz
|
69
|
+
Curl::Easy.any_instance.stub(:body_str).and_return %|{"result":"ok","value":{"pics":[{"city":{"url":"/city/los-angeles-ca/","id":27,"name":"Los Angeles, CA"},"creator":{"username":"lakers","display_name":"Los Angeles Lakers","following_count":8,"follower_count":2364,"id":216541,"icon":{"url":"http://s1.ui1.picplzthumbs.com/usericons/c7/46/be/c746bee5eb6926e71f46176fddbd3fc16fc9b198_meds.jpg","width":75,"height":75}},"url":"/user/lakers/pic/6rlcc/","pic_files":{"640r":{"width":640,"img_url":"http://s1.i1.picplzthumbs.com/upload/img/7c/54/a0/7c54a0a10d3e97bef7ac570e14f461b1836e9168_wmeg.jpg","height":478},"100sh":{"width":100,"img_url":"http://s1.i1.picplzthumbs.com/upload/img/7c/54/a0/7c54a0a10d3e97bef7ac570e14f461b1836e9168_t200s.jpg","height":100},"320rh":{"width":320,"img_url":"http://s1.i1.picplzthumbs.com/upload/img/7c/54/a0/7c54a0a10d3e97bef7ac570e14f461b1836e9168_mmed.jpg","height":239}},"view_count":10873,"caption":"The playoff logo down on the floor.","comment_count":2,"like_count":24,"place":{"url":"/pics/staples-center-los-angeles-ca/","id":17357,"name":"STAPLES Center"},"date":1303059128,"id":1662796}]}}|
|
70
|
+
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
71
|
+
end
|
72
|
+
|
73
|
+
def stub_lockerz
|
74
|
+
Curl::Easy.any_instance.stub(:body_str).and_return %|{"BigImageUrl":"http:\/\/c0013763.cdn1.cloudfiles.rackspacecloud.com\/x2_5f9fc67","CommentCount":1,"DetailsUrl":"http:\/\/api.plixi.com\/api\/tpapi.svc\/json\/photos\/100269159","GdAlias":"100269159","Id":100269159,"LargeImageUrl":"http:\/\/c0013763.cdn1.cloudfiles.rackspacecloud.com\/x2_5f9fc67","LikedVotes":0,"Location":{"Latitude":0,"Longitude":0},"MediumImageUrl":"http:\/\/c0013764.cdn1.cloudfiles.rackspacecloud.com\/x2_5f9fc67","Message":"Her name is Tofoi Al Nasr , she Reps the future of Qatar. @ the Doha Forum, technology is the new Revolution! ","MobileImageUrl":"http:\/\/c0013765.cdn1.cloudfiles.rackspacecloud.com\/x2_5f9fc67","Name":"x2_5f9fc67","SmallImageUrl":"http:\/\/c0013766.cdn1.cloudfiles.rackspacecloud.com\/x2_5f9fc67","ThumbnailUrl":"http:\/\/c0013767.cdn1.cloudfiles.rackspacecloud.com\/x2_5f9fc67","TinyAlias":"100269159","TwitterStatusId":67672440125394944,"UnLikedVotes":0,"UploadDate":1304969336,"UploadDateString":"2011-05-09T19:28:56Z","UserId":1067006,"Views":9319,"Vote":null}|
|
75
|
+
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
76
|
+
end
|
77
|
+
|
78
|
+
#follow redirect lookups
|
79
|
+
|
80
|
+
def stub_imgly
|
81
|
+
curl = Curl::Easy.new
|
82
|
+
Curl::Easy.any_instance.stub(:perform).and_return curl
|
83
|
+
Curl::Easy.stub!(:http_get).and_return curl
|
84
|
+
Curl::Easy.any_instance.stub(:header_str).and_return %|HTTP/1.1 302 Found
|
85
|
+
Content-Type: text/html; charset=utf-8
|
86
|
+
Connection: keep-alive
|
87
|
+
Status: 302
|
88
|
+
X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.7
|
89
|
+
Location: http://s3.amazonaws.com/imgly_production/899582/full.jpg\r\nX-Runtime: 5
|
90
|
+
Content-Length: 122
|
91
|
+
Set-Cookie: _imgly_session=BAh7BjoPc2Vzc2lvbl9pZCIlZTk3ZDI2ZmNhNWJjNGVjOTVjNDdiNThjOWFkYjliNTY%3D--83345d9317715d664bcb5de63b0529488a17a351; domain=.img.ly; path=/; expires=Sun, 31-Jul-2011 00:59:06 GMT; HttpOnly
|
92
|
+
Cache-Control: no-cache
|
93
|
+
Server: nginx/1.0.0 + Phusion Passenger 3.0.7 (mod_rails/mod_rack)
|
94
|
+
|
95
|
+
|
|
96
|
+
end
|
97
|
+
|
98
|
+
def stub_twitpic
|
99
|
+
curl = Curl::Easy.new
|
100
|
+
Curl::Easy.any_instance.stub(:perform).and_return curl
|
101
|
+
Curl::Easy.any_instance.stub(:header_str).and_return %|HTTP/1.1 302 Moved Temporarily
|
102
|
+
Server: nginx
|
103
|
+
Date: Sun, 17 Jul 2011 01:03:43 GMT
|
104
|
+
Content-Type: image/jpeg
|
105
|
+
Transfer-Encoding: chunked
|
106
|
+
Connection: keep-alive
|
107
|
+
X-Powered-By: PHP/5.3.5-1ubuntu7.2
|
108
|
+
Last-Modified: Sat, 16 Jul 2011 22:17:03 GMT
|
109
|
+
Etag: 0fe3c085839afa6e42ce28973192704a
|
110
|
+
Cache-Control: maxage=10000
|
111
|
+
Expires: Sun, 17 Jul 2011 03:50:23 GMT
|
112
|
+
Pragma: public
|
113
|
+
Location: http://s3.amazonaws.com/twitpic/photos/full/249034281.jpg?AWSAccessKeyId=AKIAJF3XCCKACR3QDMOA&Expires=1310865623&Signature=KNFdFAK%2Bu0u3maMaguUjsm2MbaM%3D\r\n
|
114
|
+
|
|
115
|
+
#stub redirected call's response
|
116
|
+
Curl::Easy.stub!(:http_get).and_return curl
|
117
|
+
Curl::Easy.any_instance.stub(:body_str).and_return %|http://s3.amazonaws.com/twitpic/photos/full/249034281.jpg?AWSAccessKeyId=AKIAJF3XCCKACR3QDMOA&Expires=1310865623&Signature=KNFdFAK%2Bu0u3maMaguUjsm2MbaM%3D\r\n|
|
118
|
+
end
|
119
|
+
|
120
|
+
def stub_tco
|
121
|
+
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
122
|
+
Curl::Easy.any_instance.stub(:header_str).and_return %|HTTP/1.1 301 Moved Permanently
|
123
|
+
Date: Sun, 17 Jul 2011 01:03:51 GMT
|
124
|
+
Server: hi
|
125
|
+
Location: http://yfrog.com/h0m3vpj
|
126
|
+
Cache-Control: private,max-age=300
|
127
|
+
Expires: Sun, 17 Jul 2011 01:08:51 GMT
|
128
|
+
Content-Length: 0
|
129
|
+
Connection: close
|
130
|
+
Content-Type: text/html; charset=UTF-8
|
131
|
+
|
132
|
+
|
|
133
|
+
stub_yfrog
|
134
|
+
end
|
135
|
+
|
136
|
+
#embedly powered lookups
|
137
|
+
|
138
|
+
def stub_foursquare
|
139
|
+
Curl::Easy.any_instance.stub(:body_str).and_return %|{"provider_url": "http://foursquare.com", "description": "See where your friends are, learn about the places they frequent, and unlock rewards as you travel. 8555 Fletcher PkwyLa Mesa, CA 91942(619) 589-0071", "title": "Matt S. checked in at Banbu Sushi Bar And Grill", "url": "https://playfoursquare.s3.amazonaws.com/pix/PNIBDBIPP5G2XGROCZXVCOHABOZP4MICHZVPJWZXZWAN3SEQ.jpg", "author_name": "Matt S.", "height": 345, "width": 460, "thumbnail_url": "https://playfoursquare.s3.amazonaws.com/pix/PNIBDBIPP5G2XGROCZXVCOHABOZP4MICHZVPJWZXZWAN3SEQ.jpg", "thumbnail_width": 460, "version": "1.0", "provider_name": "Foursquare", "type": "photo", "thumbnail_height": 345, "author_url": "https://foursquare.com/mjstraus"}|
|
140
|
+
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
141
|
+
end
|
142
|
+
|
143
|
+
def stub_embedly
|
144
|
+
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/"}|
|
145
|
+
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
146
|
+
end
|
147
|
+
|
148
|
+
def stub_embedly_no_photo
|
149
|
+
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}|
|
150
|
+
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
151
|
+
end
|
152
|
+
|
153
|
+
#path
|
154
|
+
|
155
|
+
def stub_path_redirected
|
156
|
+
curl = Curl::Easy.new
|
157
|
+
Curl::Easy.any_instance.stub(:perform).and_return curl
|
158
|
+
Curl::Easy.any_instance.stub(:header_str).and_return %|HTTP/1.1 302 Moved Temporarily
|
159
|
+
Date: Thu, 29 Dec 2011 20:30:22 GMT
|
160
|
+
Connection: close
|
161
|
+
Content-Length: 178
|
162
|
+
Server: nginx
|
163
|
+
Content-Type: text/html
|
164
|
+
Location: https://path.com/p/KQd57\r\n
|
165
|
+
|
|
166
|
+
#stub redirected call's response
|
167
|
+
stub_path
|
168
|
+
end
|
169
|
+
|
14
170
|
def stub_path
|
15
171
|
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
16
172
|
Curl::Easy.any_instance.stub(:body_str).and_return %^
|
@@ -270,141 +426,4 @@ def stub_path
|
|
270
426
|
</html>^
|
271
427
|
end
|
272
428
|
|
273
|
-
def stub_tumblr
|
274
|
-
Curl::Easy.any_instance.stub(:response_code).and_return 201
|
275
|
-
Curl::Easy.any_instance.stub(:header_str).and_return %|HTTP/1.1 201 Created
|
276
|
-
Date: Sun, 13 Nov 2011 16:56:02 GMT
|
277
|
-
Server: Apache
|
278
|
-
P3P: CP="ALL ADM DEV PSAi COM OUR OTRo STP IND ONL"
|
279
|
-
Vary: Accept-Encoding
|
280
|
-
X-Tumblr-Usec: D=2600406
|
281
|
-
Content-Length: 11
|
282
|
-
Connection: close
|
283
|
-
Content-Type: text/plain; charset=utf-8
|
284
|
-
|
285
|
-
|
|
286
|
-
Curl::Easy.any_instance.stub(:body_str).and_return %|12742797055|
|
287
|
-
Curl::Easy.stub!(:http_post).and_return Curl::Easy.new
|
288
|
-
stub_instagram
|
289
|
-
end
|
290
|
-
|
291
|
-
def stub_twitter
|
292
|
-
Curl::Easy.any_instance.stub(:body_str).and_return %|{"results":[{"from_user_id_str":"220650275","profile_image_url":"http://a2.twimg.com/profile_images/668619338/9729_148876458070_505518070_2628895_7160219_n_normal.jpg","created_at":"Sat, 16 Jul 2011 23:20:01 +0000","from_user":"LoMuma","id_str":"92372947855093760","metadata":{"result_type":"recent"},"to_user_id":null,"text":"Need to stop procrastinating! 5 quizzes and personal responses due tomorrow... #fail","id":92372947855093760,"from_user_id":220650275,"geo":null,"iso_language_code":"en","to_user_id_str":null,"source":"<a href="http://twitter.com/">web</a>"},{"from_user_id_str":"129718556","profile_image_url":"http://a2.twimg.com/profile_images/1428268221/twitter_normal.png","created_at":"Sat, 16 Jul 2011 23:20:01 +0000","from_user":"priiislopes","id_str":"92372947846692865","metadata":{"result_type":"recent"},"to_user_id":null,"text":"Esse jogo do Flu foi uma vergonha. Se ele fez o melhor dele no brasileiro semana passada, hj fez o pior de todos os tempos. #Fail","id":92372947846692865,"from_user_id":129718556,"geo":null,"iso_language_code":"pt","to_user_id_str":null,"source":"<a href="http://twitter.com/">web</a>"},{"from_user_id_str":"259930166","profile_image_url":"http://a3.twimg.com/profile_images/1425221519/foto_normal.jpg","created_at":"Sat, 16 Jul 2011 23:20:00 +0000","from_user":"YamiiG4","id_str":"92372943132303360","metadata":{"result_type":"recent"},"to_user_id":null,"text":"vaya que eran 2 minutos..#FAIL!","id":92372943132303360,"from_user_id":259930166,"geo":null,"iso_language_code":"es","to_user_id_str":null,"source":"<a href="http://www.tweetdeck.com" rel="nofollow">TweetDeck</a>"},{"from_user_id_str":"321557905","profile_image_url":"http://a0.twimg.com/profile_images/1445672626/profile_normal.png","created_at":"Sat, 16 Jul 2011 23:20:00 +0000","from_user":"JasWafer_FFOE","id_str":"92372941379088384","metadata":{"result_type":"recent"},"to_user_id":null,"text":"RT @eye_OFBEHOLDER: RT @JasWafer_FFOE #Oomf said that he'll NEVER eat pussy! O.o --#FAIL","id":92372941379088384,"from_user_id":321557905,"geo":null,"iso_language_code":"en","to_user_id_str":null,"source":"<a href="http://twidroyd.com" rel="nofollow">Twidroyd for Android</a>"},{"from_user_id_str":"279395613","profile_image_url":"http://a0.twimg.com/profile_images/1334871419/lnnsquare_normal.jpg","created_at":"Sat, 16 Jul 2011 23:19:59 +0000","from_user":"LanguageNewsNet","id_str":"92372940640890881","metadata":{"result_type":"recent"},"to_user_id":null,"text":"Questioning the Inca Paradox: Did the civilization behind Machu Picchu really fail to develop a written la... http://tinyurl.com/5sfos23","id":92372940640890881,"from_user_id":279395613,"geo":null,"iso_language_code":"en","to_user_id_str":null,"source":"<a href="http://twitterfeed.com" rel="nofollow">twitterfeed</a>"}],"max_id":92372947855093760,"since_id":0,"refresh_url":"?since_id=92372947855093760&q=+fail","next_page":"?page=2&max_id=92372947855093760&rpp=5&q=+fail","results_per_page":5,"page":1,"completed_in":0.022152,"since_id_str":"0","max_id_str":"92372947855093760","query":"+fail"}|
|
293
|
-
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
294
|
-
end
|
295
|
-
|
296
|
-
def stub_twitter_pics
|
297
|
-
Curl::Easy.any_instance.stub(:body_str).and_return %|{"url": "http://pic.twitter.com/stubbedpic.jpg:large"}|
|
298
|
-
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
299
|
-
end
|
300
|
-
|
301
|
-
def stub_instagram
|
302
|
-
Curl::Easy.any_instance.stub(:body_str).and_return %|{"provider_url": "http://instagram.com/", "title": "Curse you tweets. See what you have done to me?!!!", "url": "http://distillery.s3.amazonaws.com/media/2011/05/02/d25df62b9cec4a138967a3ad027d055b_7.jpg", "author_name": "loswhit", "height": 612, "width": 612, "version": "1.0", "author_url": "http://instagram.com/", "provider_name": "Instagram", "type": "photo"}|
|
303
|
-
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
304
|
-
end
|
305
429
|
|
306
|
-
#instagram syntax but without a valid image link
|
307
|
-
def stub_no_image_link
|
308
|
-
Curl::Easy.any_instance.stub(:body_str).and_return %|{"url":"http://noimageurl"}|
|
309
|
-
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
310
|
-
end
|
311
|
-
|
312
|
-
def stub_bad_request
|
313
|
-
Curl::Easy.any_instance.stub(:body_str).and_return %|<html><title>400: Bad Request - Invalid URL format http://mopskopf</title><body>400: Bad Request - Invalid URL format http://mopskopf</body></html>|
|
314
|
-
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
315
|
-
end
|
316
|
-
|
317
|
-
def stub_utf8_response
|
318
|
-
Curl::Easy.any_instance.stub(:body_str).and_return %|√∫ƒ® are inhabitänts of utf-8 wonderländ.|
|
319
|
-
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
320
|
-
end
|
321
|
-
|
322
|
-
def stub_yfrog
|
323
|
-
Curl::Easy.any_instance.stub(:body_str).and_return %|{"version":"1.0","provider_name":"yFrog","provider_url":"http:\/\/yfrog.com","thumbnail_url":"http:\/\/yfrog.com\/h4vlfp:small","width":1210,"height":894,"type":"image","url":"http:\/\/img616.yfrog.com\/img616\/16\/vlf.png"}|
|
324
|
-
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
325
|
-
end
|
326
|
-
|
327
|
-
def stub_picplz
|
328
|
-
Curl::Easy.any_instance.stub(:body_str).and_return %|{"result":"ok","value":{"pics":[{"city":{"url":"/city/los-angeles-ca/","id":27,"name":"Los Angeles, CA"},"creator":{"username":"lakers","display_name":"Los Angeles Lakers","following_count":8,"follower_count":2364,"id":216541,"icon":{"url":"http://s1.ui1.picplzthumbs.com/usericons/c7/46/be/c746bee5eb6926e71f46176fddbd3fc16fc9b198_meds.jpg","width":75,"height":75}},"url":"/user/lakers/pic/6rlcc/","pic_files":{"640r":{"width":640,"img_url":"http://s1.i1.picplzthumbs.com/upload/img/7c/54/a0/7c54a0a10d3e97bef7ac570e14f461b1836e9168_wmeg.jpg","height":478},"100sh":{"width":100,"img_url":"http://s1.i1.picplzthumbs.com/upload/img/7c/54/a0/7c54a0a10d3e97bef7ac570e14f461b1836e9168_t200s.jpg","height":100},"320rh":{"width":320,"img_url":"http://s1.i1.picplzthumbs.com/upload/img/7c/54/a0/7c54a0a10d3e97bef7ac570e14f461b1836e9168_mmed.jpg","height":239}},"view_count":10873,"caption":"The playoff logo down on the floor.","comment_count":2,"like_count":24,"place":{"url":"/pics/staples-center-los-angeles-ca/","id":17357,"name":"STAPLES Center"},"date":1303059128,"id":1662796}]}}|
|
329
|
-
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
330
|
-
end
|
331
|
-
|
332
|
-
def stub_lockerz
|
333
|
-
Curl::Easy.any_instance.stub(:body_str).and_return %|{"BigImageUrl":"http:\/\/c0013763.cdn1.cloudfiles.rackspacecloud.com\/x2_5f9fc67","CommentCount":1,"DetailsUrl":"http:\/\/api.plixi.com\/api\/tpapi.svc\/json\/photos\/100269159","GdAlias":"100269159","Id":100269159,"LargeImageUrl":"http:\/\/c0013763.cdn1.cloudfiles.rackspacecloud.com\/x2_5f9fc67","LikedVotes":0,"Location":{"Latitude":0,"Longitude":0},"MediumImageUrl":"http:\/\/c0013764.cdn1.cloudfiles.rackspacecloud.com\/x2_5f9fc67","Message":"Her name is Tofoi Al Nasr , she Reps the future of Qatar. @ the Doha Forum, technology is the new Revolution! ","MobileImageUrl":"http:\/\/c0013765.cdn1.cloudfiles.rackspacecloud.com\/x2_5f9fc67","Name":"x2_5f9fc67","SmallImageUrl":"http:\/\/c0013766.cdn1.cloudfiles.rackspacecloud.com\/x2_5f9fc67","ThumbnailUrl":"http:\/\/c0013767.cdn1.cloudfiles.rackspacecloud.com\/x2_5f9fc67","TinyAlias":"100269159","TwitterStatusId":67672440125394944,"UnLikedVotes":0,"UploadDate":1304969336,"UploadDateString":"2011-05-09T19:28:56Z","UserId":1067006,"Views":9319,"Vote":null}|
|
334
|
-
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
335
|
-
end
|
336
|
-
|
337
|
-
#follow redirect lookups
|
338
|
-
|
339
|
-
def stub_imgly
|
340
|
-
curl = Curl::Easy.new
|
341
|
-
Curl::Easy.any_instance.stub(:perform).and_return curl
|
342
|
-
Curl::Easy.stub!(:http_get).and_return curl
|
343
|
-
Curl::Easy.any_instance.stub(:header_str).and_return %|HTTP/1.1 302 Found
|
344
|
-
Content-Type: text/html; charset=utf-8
|
345
|
-
Connection: keep-alive
|
346
|
-
Status: 302
|
347
|
-
X-Powered-By: Phusion Passenger (mod_rails/mod_rack) 3.0.7
|
348
|
-
Location: http://s3.amazonaws.com/imgly_production/899582/full.jpg\r\nX-Runtime: 5
|
349
|
-
Content-Length: 122
|
350
|
-
Set-Cookie: _imgly_session=BAh7BjoPc2Vzc2lvbl9pZCIlZTk3ZDI2ZmNhNWJjNGVjOTVjNDdiNThjOWFkYjliNTY%3D--83345d9317715d664bcb5de63b0529488a17a351; domain=.img.ly; path=/; expires=Sun, 31-Jul-2011 00:59:06 GMT; HttpOnly
|
351
|
-
Cache-Control: no-cache
|
352
|
-
Server: nginx/1.0.0 + Phusion Passenger 3.0.7 (mod_rails/mod_rack)
|
353
|
-
|
354
|
-
|
|
355
|
-
end
|
356
|
-
|
357
|
-
def stub_twitpic
|
358
|
-
curl = Curl::Easy.new
|
359
|
-
Curl::Easy.any_instance.stub(:perform).and_return curl
|
360
|
-
Curl::Easy.any_instance.stub(:header_str).and_return %|HTTP/1.1 302 Moved Temporarily
|
361
|
-
Server: nginx
|
362
|
-
Date: Sun, 17 Jul 2011 01:03:43 GMT
|
363
|
-
Content-Type: image/jpeg
|
364
|
-
Transfer-Encoding: chunked
|
365
|
-
Connection: keep-alive
|
366
|
-
X-Powered-By: PHP/5.3.5-1ubuntu7.2
|
367
|
-
Last-Modified: Sat, 16 Jul 2011 22:17:03 GMT
|
368
|
-
Etag: 0fe3c085839afa6e42ce28973192704a
|
369
|
-
Cache-Control: maxage=10000
|
370
|
-
Expires: Sun, 17 Jul 2011 03:50:23 GMT
|
371
|
-
Pragma: public
|
372
|
-
Location: http://s3.amazonaws.com/twitpic/photos/full/249034281.jpg?AWSAccessKeyId=AKIAJF3XCCKACR3QDMOA&Expires=1310865623&Signature=KNFdFAK%2Bu0u3maMaguUjsm2MbaM%3D\r\n
|
373
|
-
|
|
374
|
-
#stub redirected call's response
|
375
|
-
Curl::Easy.stub!(:http_get).and_return curl
|
376
|
-
Curl::Easy.any_instance.stub(:body_str).and_return %|http://s3.amazonaws.com/twitpic/photos/full/249034281.jpg?AWSAccessKeyId=AKIAJF3XCCKACR3QDMOA&Expires=1310865623&Signature=KNFdFAK%2Bu0u3maMaguUjsm2MbaM%3D\r\n|
|
377
|
-
end
|
378
|
-
|
379
|
-
def stub_tco
|
380
|
-
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
381
|
-
Curl::Easy.any_instance.stub(:header_str).and_return %|HTTP/1.1 301 Moved Permanently
|
382
|
-
Date: Sun, 17 Jul 2011 01:03:51 GMT
|
383
|
-
Server: hi
|
384
|
-
Location: http://yfrog.com/h0m3vpj
|
385
|
-
Cache-Control: private,max-age=300
|
386
|
-
Expires: Sun, 17 Jul 2011 01:08:51 GMT
|
387
|
-
Content-Length: 0
|
388
|
-
Connection: close
|
389
|
-
Content-Type: text/html; charset=UTF-8
|
390
|
-
|
391
|
-
|
|
392
|
-
stub_yfrog
|
393
|
-
end
|
394
|
-
|
395
|
-
#embedly powered lookups
|
396
|
-
|
397
|
-
def stub_foursquare
|
398
|
-
Curl::Easy.any_instance.stub(:body_str).and_return %|{"provider_url": "http://foursquare.com", "description": "See where your friends are, learn about the places they frequent, and unlock rewards as you travel. 8555 Fletcher PkwyLa Mesa, CA 91942(619) 589-0071", "title": "Matt S. checked in at Banbu Sushi Bar And Grill", "url": "https://playfoursquare.s3.amazonaws.com/pix/PNIBDBIPP5G2XGROCZXVCOHABOZP4MICHZVPJWZXZWAN3SEQ.jpg", "author_name": "Matt S.", "height": 345, "width": 460, "thumbnail_url": "https://playfoursquare.s3.amazonaws.com/pix/PNIBDBIPP5G2XGROCZXVCOHABOZP4MICHZVPJWZXZWAN3SEQ.jpg", "thumbnail_width": 460, "version": "1.0", "provider_name": "Foursquare", "type": "photo", "thumbnail_height": 345, "author_url": "https://foursquare.com/mjstraus"}|
|
399
|
-
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
400
|
-
end
|
401
|
-
|
402
|
-
def stub_embedly
|
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
|
-
Curl::Easy.any_instance.stub(:perform).and_return Curl::Easy.new
|
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.10
|
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-29 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: daemons
|
16
|
-
requirement: &
|
16
|
+
requirement: &2153375840 !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: *2153375840
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: eventmachine
|
27
|
-
requirement: &
|
27
|
+
requirement: &2153375100 !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: *2153375100
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: curb
|
38
|
-
requirement: &
|
38
|
+
requirement: &2153370580 !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: *2153370580
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: json
|
49
|
-
requirement: &
|
49
|
+
requirement: &2153370160 !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: *2153370160
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: nokogiri
|
60
|
-
requirement: &
|
60
|
+
requirement: &2153369740 !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: *2153369740
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
|
-
requirement: &
|
71
|
+
requirement: &2153369320 !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: *2153369320
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: rspec
|
82
|
-
requirement: &
|
82
|
+
requirement: &2153368900 !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: *2153368900
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: rdoc
|
93
|
-
requirement: &
|
93
|
+
requirement: &2153368420 !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: *2153368420
|
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
|