RSS FEEDS

N

Newb Newb

Using Rss Parser I loaded Some Url's into the database.
All The Rss feeds has been stored in the table.
All The Rss Stories Has Been Stored In the Stories Table.
Stories Table Has Fields Like Story Name Story Description
Story Description Fields Contains Images Too...
That Story description must Not Contain Images
I want to restrict the images Not to be shown in the view.
Images has to be displayed separetely.Not Inside the Story Description
field.
I Extracted the Images and dispalyed separately using Hpricot.
But My Story Description Field Shows the Images. I don't Know How to
Restrict the Images To Be Shown..
Any Advices...


My COde Starts Here


require 'rss'
require 'open-uri'
require 'hpricot'

@feeds = Feed.find:)all)
@feeds.each do |f|
puts f.url
feed = RSS::parser.parse(f.url)


puts "== #{feed.channel.title} =="
puts "channel name: #{feed.channel.title}"
feed.items.each do |item|
puts "Title: #{item.title}"
puts "URL: #{item.link}"

puts "Description: #{item.description}"




@stories = Story.new
@stories.title = item.title
@stories.description = item.description
@stories.feed_id = item.id
@stories.guid = item.guid

doc = Hpricot.parse(item.description)
imgs = doc.search("//img")


@src_array = imgs.collect{|img|img.attributes["src"]}

@src_array = @src_array.to_s


@stories.picture = @src_array
@stories.save

end
end
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,981
Messages
2,570,188
Members
46,731
Latest member
MarcyGipso

Latest Threads

Top