Here we look at reading RSS feeds in CW.

RSS Feed Reading

There are plenty of RSS feeds available over the internet that can be utilized to help improve code recognition and comprehension. Several are included with CW whilst others may be added.

The built-in feeds are:

  • Reuters (news feed)
  • BBC (news feed)
  • Guardian (news feed)
  • Quotation (quotation updated daily)

read_rss command

You use the read_rss command to read RSS feeds. read_rss accepts two parameters:

  • source
  • article_count

Read the quote of the day

  require "cw"

# rss_feed.rb

cw do
  comment 'read daily quotation via RSS feed (1 article)'
  read_rss(:quotation, 1)
  wpm 18
  ewpm 12
end



Play two articles from the BBC feed

  require "cw"

# rss_feed_2.rb

cw do
  comment 'read 2 BBC news articles'
  read_rss(:bbc, 2)
  wpm 18
  ewpm 12
end