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.
@@ -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
- embedded = uri.query_values['url']
156
- uri = clean(embedded, false) if embedded
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
 
@@ -13,6 +13,9 @@
13
13
  - partner
14
14
  - emc
15
15
  - _r
16
+ - ref
17
+ diepresse.com:
18
+ - _vl_backlink
16
19
  washingtonpost.com:
17
20
  - nav
18
21
  - wprss
@@ -1,5 +1,5 @@
1
1
  module PostRank
2
2
  module URI
3
- VERSION = "1.0.6"
3
+ VERSION = "1.0.7"
4
4
  end
5
5
  end
@@ -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
 
@@ -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
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 6
9
- version: 1.0.6
8
+ - 7
9
+ version: 1.0.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ilya Grigorik