Work with your Slideshare feed
Tagged with
Ruby
Language: Ruby
This pulls in your slides from Slideshare and builds either an unordered list of embed calls which you could style to your liking, or a more customizable list of thumbnails.
View as text
require 'nokogiri'
def slideshare_embed_list(username)
rss_url = "http://www.slideshare.net/rss/user/#{username}/presentations"
input = Nokogiri::XML(Kernel.open(rss_url))
output = "<ul>"
input.root.xpath("//slideshare:embed").each {|n| output << "<li>#{n.text}</li>"}
output << "</ul>"
end
def slideshare_list(username)
rss_url = "http://www.slideshare.net/rss/user/#{username}/presentations"
input = Nokogiri::XML(Kernel.open(rss_url))
output = "<ul>"
input.root.xpath("//media:content").each do |n|
img = n.xpath("media:thumbnail").attr("url")
link = n.xpath("media:player").attr("url")
title = n.xpath("media:title").text
desc = n.xpath("media:description").text
output << %Q{
<div class="item">
<span class="image">
<a href="#{link}" class="popup"><img src="#{img}" alt="#{title}"></a>
</span>
<span class="text">
<h4>#{title}</h4>
<p>#{desc}</p>
</span>
<div class="clear"></div>
</div>
}
end
output << "</ul>"
end