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