rfeedreader 0.9.3 → 0.9.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,7 @@
1
+ == 0.9.4 2007-09-03
2
+
3
+ * Add link attribute to read URL of the HTML page associated with a feed.
4
+
1
5
  == 0.9.3 2007-09-03
2
6
 
3
7
  * Add method to only read feed header
@@ -102,12 +102,13 @@ module Rfeedreader
102
102
  end
103
103
 
104
104
  class Feed
105
- attr_accessor :title, :link, :charset, :entries
105
+ attr_accessor :feed_url, :title, :link, :charset, :entries
106
106
 
107
107
  def initialize(link, hpricot_doc)
108
- @link = link
108
+ @feed_url = link
109
109
  puts "link: #{link}"
110
110
  read_title hpricot_doc
111
+ read_link hpricot_doc
111
112
  read_charset hpricot_doc
112
113
  @entries = []
113
114
  end
@@ -136,7 +137,7 @@ module Rfeedreader
136
137
  end
137
138
 
138
139
  def to_s
139
- "Feed: title: #{title} - charset: #{charset}\n\rlink: #{link} - Entries: #{entries.size}"
140
+ "Feed #{feed_url}: title: #{title} - charset: #{charset}\n\rlink: #{link} - Entries: #{entries.size}"
140
141
  end
141
142
 
142
143
  def display_entries
@@ -159,13 +160,19 @@ module Rfeedreader
159
160
  def read_title(hpricot_doc)
160
161
  @title = (hpricot_doc/"//title:first").text
161
162
  end
163
+
164
+ def read_link(hpricot_doc)
165
+ @link = (doc/"link").first.inner_text
166
+ @link = (doc/"link[@rel=alternate]").first[:href] if @link.empty?
167
+ @link = (doc/"link").first[:href] if @link.empty?
168
+ end
162
169
 
163
170
  def source_type
164
- return "source_flickr" if link =~ /http:\/\/api\.flickr\.com/
165
- return "source_fotolog" if link =~ /\.fotolog\.com/
166
- return "source_google_video" if link =~ /http:\/\/video\.google\.com/
167
- return "source_jumpcut" if link =~ /http:\/\/rss\.jumpcut\.com/
168
- return "source_picasa" if link =~ /http:\/\/picasaweb\.google\.com/
171
+ return "source_flickr" if @feed_url =~ /http:\/\/api\.flickr\.com/
172
+ return "source_fotolog" if @feed_url =~ /\.fotolog\.com/
173
+ return "source_google_video" if @feed_url =~ /http:\/\/video\.google\.com/
174
+ return "source_jumpcut" if @feed_url =~ /http:\/\/rss\.jumpcut\.com/
175
+ return "source_picasa" if @feed_url =~ /http:\/\/picasaweb\.google\.com/
169
176
  return ""
170
177
  end
171
178
  end
@@ -2,7 +2,7 @@ module Rfeedreader #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
4
  MINOR = 9
5
- TINY = 3
5
+ TINY = 4
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
@@ -33,7 +33,7 @@
33
33
  <h1>rfeedreader</h1>
34
34
  <div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/rfeedreader"; return false'>
35
35
  <p>Get Version</p>
36
- <a href="http://rubyforge.org/projects/rfeedreader" class="numbers">0.9.3</a>
36
+ <a href="http://rubyforge.org/projects/rfeedreader" class="numbers">0.9.4</a>
37
37
  </div>
38
38
  <h2>What</h2>
39
39
 
metadata CHANGED
@@ -3,7 +3,7 @@ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: rfeedreader
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.9.3
6
+ version: 0.9.4
7
7
  date: 2007-09-03 00:00:00 +02:00
8
8
  summary: Feed parser to read feed and return first posts of this feed. Special parsing from sources like Flickr, Jumcut, Google video, ...
9
9
  require_paths: