Edit File by line
/home/barbar84/www/wp-conte.../plugins/sujqvwi/ExeBy/exe_root.../opt/alt/ruby22/lib64/ruby/2.2.0
File: rss.rb
##
[0] Fix | Delete
# = RSS reading and writing
[1] Fix | Delete
#
[2] Fix | Delete
# Really Simple Syndication (RSS) is a family of formats that describe 'feeds,'
[3] Fix | Delete
# specially constructed XML documents that allow an interested person to
[4] Fix | Delete
# subscribe and receive updates from a particular web service. This portion of
[5] Fix | Delete
# the standard library provides tooling to read and create these feeds.
[6] Fix | Delete
#
[7] Fix | Delete
# The standard library supports RSS 0.91, 1.0, 2.0, and Atom, a related format.
[8] Fix | Delete
# Here are some links to the standards documents for these formats:
[9] Fix | Delete
#
[10] Fix | Delete
# * RSS
[11] Fix | Delete
# * 0.9.1[http://www.rssboard.org/rss-0-9-1-netscape]
[12] Fix | Delete
# * 1.0[http://web.resource.org/rss/1.0/]
[13] Fix | Delete
# * 2.0[http://www.rssboard.org/rss-specification]
[14] Fix | Delete
# * Atom[http://tools.ietf.org/html/rfc4287]
[15] Fix | Delete
#
[16] Fix | Delete
# == Consuming RSS
[17] Fix | Delete
#
[18] Fix | Delete
# If you'd like to read someone's RSS feed with your Ruby code, you've come to
[19] Fix | Delete
# the right place. It's really easy to do this, but we'll need the help of
[20] Fix | Delete
# open-uri:
[21] Fix | Delete
#
[22] Fix | Delete
# require 'rss'
[23] Fix | Delete
# require 'open-uri'
[24] Fix | Delete
#
[25] Fix | Delete
# url = 'http://www.ruby-lang.org/en/feeds/news.rss'
[26] Fix | Delete
# open(url) do |rss|
[27] Fix | Delete
# feed = RSS::Parser.parse(rss)
[28] Fix | Delete
# puts "Title: #{feed.channel.title}"
[29] Fix | Delete
# feed.items.each do |item|
[30] Fix | Delete
# puts "Item: #{item.title}"
[31] Fix | Delete
# end
[32] Fix | Delete
# end
[33] Fix | Delete
#
[34] Fix | Delete
# As you can see, the workhorse is RSS::Parser#parse, which takes the source of
[35] Fix | Delete
# the feed and a parameter that performs validation on the feed. We get back an
[36] Fix | Delete
# object that has all of the data from our feed, accessible through methods.
[37] Fix | Delete
# This example shows getting the title out of the channel element, and looping
[38] Fix | Delete
# through the list of items.
[39] Fix | Delete
#
[40] Fix | Delete
# == Producing RSS
[41] Fix | Delete
#
[42] Fix | Delete
# Producing our own RSS feeds is easy as well. Let's make a very basic feed:
[43] Fix | Delete
#
[44] Fix | Delete
# require "rss"
[45] Fix | Delete
#
[46] Fix | Delete
# rss = RSS::Maker.make("atom") do |maker|
[47] Fix | Delete
# maker.channel.author = "matz"
[48] Fix | Delete
# maker.channel.updated = Time.now.to_s
[49] Fix | Delete
# maker.channel.about = "http://www.ruby-lang.org/en/feeds/news.rss"
[50] Fix | Delete
# maker.channel.title = "Example Feed"
[51] Fix | Delete
#
[52] Fix | Delete
# maker.items.new_item do |item|
[53] Fix | Delete
# item.link = "http://www.ruby-lang.org/en/news/2010/12/25/ruby-1-9-2-p136-is-released/"
[54] Fix | Delete
# item.title = "Ruby 1.9.2-p136 is released"
[55] Fix | Delete
# item.updated = Time.now.to_s
[56] Fix | Delete
# end
[57] Fix | Delete
# end
[58] Fix | Delete
#
[59] Fix | Delete
# puts rss
[60] Fix | Delete
#
[61] Fix | Delete
# As you can see, this is a very Builder-like DSL. This code will spit out an
[62] Fix | Delete
# Atom feed with one item. If we needed a second item, we'd make another block
[63] Fix | Delete
# with maker.items.new_item and build a second one.
[64] Fix | Delete
#
[65] Fix | Delete
# == Copyright
[66] Fix | Delete
#
[67] Fix | Delete
# Copyright (c) 2003-2007 Kouhei Sutou <kou@cozmixng.org>
[68] Fix | Delete
#
[69] Fix | Delete
# You can redistribute it and/or modify it under the same terms as Ruby.
[70] Fix | Delete
#
[71] Fix | Delete
# There is an additional tutorial by the author of RSS at:
[72] Fix | Delete
# http://www.cozmixng.org/~rwiki/?cmd=view;name=RSS+Parser%3A%3ATutorial.en
[73] Fix | Delete
[74] Fix | Delete
module RSS
[75] Fix | Delete
end
[76] Fix | Delete
[77] Fix | Delete
require 'rss/1.0'
[78] Fix | Delete
require 'rss/2.0'
[79] Fix | Delete
require 'rss/atom'
[80] Fix | Delete
require 'rss/content'
[81] Fix | Delete
require 'rss/dublincore'
[82] Fix | Delete
require 'rss/image'
[83] Fix | Delete
require 'rss/itunes'
[84] Fix | Delete
require 'rss/slash'
[85] Fix | Delete
require 'rss/syndication'
[86] Fix | Delete
require 'rss/taxonomy'
[87] Fix | Delete
require 'rss/trackback'
[88] Fix | Delete
[89] Fix | Delete
require "rss/maker"
[90] Fix | Delete
[91] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function