Skip to content

Instantly share code, notes, and snippets.

@biske
Last active August 29, 2015 14:10
Show Gist options
  • Save biske/4f7719a88b8a225279fd to your computer and use it in GitHub Desktop.
Save biske/4f7719a88b8a225279fd to your computer and use it in GitHub Desktop.
require 'open-uri'
require 'nokogiri'
doc = Nokogiri::XML(open("http://www.blic.rs/rss/danasnje-vesti"))
items = doc.xpath("//item")
puts "Укупан број данашњих вести: #{items.count}"
items.each do |item|
puts "Naslov: #{item.xpath("./title").text}"
puts "Opis: #{item.xpath("./description").text}"
puts "Link ka originalnoj vesti: #{item.xpath("./link").text}"
puts "Guid: #{item.xpath("./guid").text}"
puts "Datum objavljivanja: #{item.xpath("./pubDate").text}"
puts "----------------------------------------------------------------------------------------------"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment