postrank-uri 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/postrank-uri.rb +7 -4
- data/lib/postrank-uri/c18n.yml +3 -0
- data/lib/postrank-uri/version.rb +1 -1
- data/spec/c18n_hosts.yml +6 -0
- data/spec/postrank-uri_spec.rb +5 -0
- metadata +2 -2
data/lib/postrank-uri.rb
CHANGED
@@ -140,7 +140,7 @@ module PostRank
|
|
140
140
|
end
|
141
141
|
u.query_values = q
|
142
142
|
|
143
|
-
if u.host == 'twitter.com' && u.fragment.match(/^!(.*)/)
|
143
|
+
if u.host == 'twitter.com' && u.fragment && u.fragment.match(/^!(.*)/)
|
144
144
|
u.fragment = nil
|
145
145
|
u.path = $1
|
146
146
|
end
|
@@ -149,12 +149,15 @@ module PostRank
|
|
149
149
|
end
|
150
150
|
|
151
151
|
def embedded(uri)
|
152
|
-
if uri.host == 'news.google.com' && uri.path == '/news/url' \
|
152
|
+
embedded = if uri.host == 'news.google.com' && uri.path == '/news/url' \
|
153
153
|
|| uri.host == 'xfruits.com'
|
154
|
+
uri.query_values['url']
|
154
155
|
|
155
|
-
|
156
|
-
|
156
|
+
elsif uri.host =~ /myspace\.com/ && uri.path =~ /PostTo/
|
157
|
+
embedded = uri.query_values['u']
|
157
158
|
end
|
159
|
+
|
160
|
+
uri = clean(embedded, false) if embedded
|
158
161
|
uri
|
159
162
|
end
|
160
163
|
|
data/lib/postrank-uri/c18n.yml
CHANGED
data/lib/postrank-uri/version.rb
CHANGED
data/spec/c18n_hosts.yml
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
- - http://www.nytimes.com/2010/12/16/world/europe/16russia.html?_r=1&partner=rss&emc=rss
|
3
3
|
- http://www.nytimes.com/2010/12/16/world/europe/16russia.html
|
4
4
|
|
5
|
+
- - http://www.nytimes.com/2011/02/20/magazine/20FOB-Medium-t.html?ref=magazine
|
6
|
+
- http://www.nytimes.com/2011/02/20/magazine/20FOB-Medium-t.html
|
7
|
+
|
8
|
+
- - http://diepresse.com/home/wirtschaft/636448/Griechenland_Drachme-als-letzte-Rettung?_vl_backlink=%2Fhome
|
9
|
+
- http://diepresse.com/home/wirtschaft/636448/Griechenland_Drachme-als-letzte-Rettung
|
10
|
+
|
5
11
|
- - http://dotearth.blogs.nytimes.com/2010/12/14/beyond-political-science/?partner=rss&emc=rss
|
6
12
|
- http://dotearth.blogs.nytimes.com/2010/12/14/beyond-political-science/
|
7
13
|
|
data/spec/postrank-uri_spec.rb
CHANGED
@@ -132,6 +132,11 @@ describe PostRank::URI do
|
|
132
132
|
u = c('http://xfruits.com/MrGroar/?url=http%3A%2F%2Faap.lesroyaumes.com%2Fdepeches%2Fdepeche351820908.html')
|
133
133
|
u.should == 'http://aap.lesroyaumes.com/depeches/depeche351820908.html'
|
134
134
|
end
|
135
|
+
|
136
|
+
it "should extract embedded redirects from MySpace" do
|
137
|
+
u = c('http://www.myspace.com/Modules/PostTo/Pages/?u=http%3A%2F%2Fghanaian-chronicle.com%2Fnews%2Fother-news%2Fcanadian-high-commissioner-urges-media%2F&t=Canadian%20High%20Commissioner%20urges%20media')
|
138
|
+
u.should == 'http://ghanaian-chronicle.com/news/other-news/canadian-high-commissioner-urges-media/'
|
139
|
+
end
|
135
140
|
end
|
136
141
|
end
|
137
142
|
|