rfeedfinder 0.9.5 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.9.6 2007-09-08
2
+
3
+ * Add timeout on http request
4
+
1
5
  == 0.9.5 2007-09-05
2
6
 
3
7
  * Decode html entities in input uri
data/lib/rfeedfinder.rb CHANGED
@@ -5,6 +5,8 @@ require 'open-uri'
5
5
  require 'hpricot'
6
6
  require 'timeout'
7
7
 
8
+ require 'rfeedfinder/version'
9
+
8
10
  module Rfeedfinder
9
11
 
10
12
  module_function
@@ -127,24 +129,6 @@ module Rfeedfinder
127
129
  return feeds
128
130
  end
129
131
 
130
- def open_doc(link)
131
- begin
132
- data = Hpricot(open(link,
133
- "User-Agent" => "Ruby/#{RUBY_VERSION} - Rfeedfinder",
134
- "From" => "rfeedfinder@googlegroups.com",
135
- "Referer" => "http://rfeedfinder.rubyforge.org/"), :xml => true)
136
- rescue Timeout::Error
137
- return nil
138
- rescue OpenURI::HTTPError
139
- html = Net::HTTP.get(URI.parse(link))
140
- data = Hpricot(html, :xml => true)
141
- rescue => err
142
- puts "Error while opening #{link} with Hpricot: #{err.class} " << $!
143
- return nil
144
- end
145
- return data
146
- end
147
-
148
132
  def feeds(uri, all=false, querySyndic8=false, _recurs=nil)
149
133
  uri = HTMLEntities.decode_entities(uri)
150
134
  _recurs = [uri] if _recurs.nil?
@@ -261,6 +245,34 @@ module Rfeedfinder
261
245
  return nil
262
246
  end
263
247
  end
264
- end
265
-
266
- require 'rfeedfinder/version'
248
+
249
+ def open_doc(link)
250
+ data = nil
251
+ begin
252
+ Timeout::timeout(20) {
253
+ data = Hpricot(open(link,
254
+ "User-Agent" => "Ruby/#{RUBY_VERSION} - Rfeedfinder",
255
+ "From" => "rfeedfinder@googlegroups.com",
256
+ "Referer" => "http://rfeedfinder.rubyforge.org/"), :xml => true)
257
+ }
258
+ rescue OpenURI::HTTPError
259
+ begin
260
+ Timeout::timeout(20) {
261
+ html = Net::HTTP.get(URI.parse(link))
262
+ data = Hpricot(html, :xml => true) if html.to_s !~ /404 Not Found/
263
+ }
264
+ rescue Timeout::Error
265
+ return nil
266
+ rescue => err
267
+ puts "Error while opening #{link} with Hpricot: #{err.class} " << $!
268
+ return nil
269
+ end
270
+ rescue Timeout::Error
271
+ return nil
272
+ rescue => err
273
+ puts "Error while opening #{link} with Hpricot: #{err.class} " << $!
274
+ return nil
275
+ end
276
+ return data
277
+ end
278
+ end
@@ -2,7 +2,7 @@ module Rfeedfinder #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 9
5
- TINY = 5
5
+ TINY = 6
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/website/index.html CHANGED
@@ -33,7 +33,7 @@
33
33
  <h1>rfeedfinder</h1>
34
34
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/rfeedfinder"; return false'>
35
35
  <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/rfeedfinder" class="numbers">0.9.5</a>
36
+ <a href="http://rubyforge.org/projects/rfeedfinder" class="numbers">0.9.6</a>
37
37
  </div>
38
38
  <h2>What</h2>
39
39
 
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: rfeedfinder
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.9.5
7
- date: 2007-09-04 00:00:00 +02:00
6
+ version: 0.9.6
7
+ date: 2007-09-08 00:00:00 +02:00
8
8
  summary: rFeedFinder uses RSS autodiscovery, Atom autodiscovery, spidering, URL correction, and Web service queries -- whatever it takes -- to find the feed.
9
9
  require_paths:
10
10
  - lib