♊️ GemiNews 🗞️ (dev)

Demo 1: Embeddings + Recommendation Demo 2: Bella RAGa Demo 3: NewRetriever Demo 4: Assistant function calling

🗞️RSS and Ruby — It’s Really Simple

🗿Semantically Similar Articles (by :title_embedding)

RSS and Ruby — It’s Really Simple

2017-12-21 - Kevin Randles (from Kevin Randles on Medium)

No, really, it is…I’ve been using an RSS aggregator as my primary method of consuming news for about 10 years, so now that I’m learning how to do more with Ruby than just execute blocks of code, I thought I’d dig into how I can use Ruby to interact with an RSS feed and see just what I can do with it. As it turns out, it’s really quite simple.What is RSS?RSS, created by a couple engineers at Netscape back in the days when Netscape was still a thing, originally stood for Rich Site Summary (thanks, Wikipedia!) but is now known as Really Simple Syndication and it, along with the very similar Atom, is a standardized format for providing a feed of a website’s content, generally to be used by a feed aggregator, such as Feedly or the late, lamented Google Reader.There’s an xkcd for everything.If you’re not sure why this would be useful, well…just try keeping up with the content of a few dozen pages without using an aggregator. Sure, you could follow them all on Twitter or Google Plus (LOL), as long as you’re cool with an algorithm deciding which posts actually show up in your feed, but a good RSS aggregator will give you total control over your newsfeed and ensure that you never miss a post, to say nothing of the ability to turn a Craigslist or eBay search into a custom RSS feed.OK, so how does it work?An RSS feed is just an XML-formatted document, and if you’ve ever published a blog post then you’ve almost certainly published an RSS feed along with it, whether you were aware of it or now. Below is the RSS feed for this very blog, which you can see for yourself at https://medium.com/feed/@krandles.Since I’m in the middle of writing my first post here, it doesn’t actually contain any articles yet, but you can see it already provides some basic information about my blog, and we’ll take a look at an actual post a bit later on.First, let’s get into how we can use Ruby to scrape an RSS feed from a website and turn it into something we can work with.require ‘rss’A quick search of rubygems.org for “rss” returns a couple hundred results, but all we need to get started (along with open-uri, so Ruby can open webpages) is Ruby’s standard library, which provides the ability to produce and consume feeds via the RSS module:require 'rss'require 'open-uri'Trying out the example code provided in the Ruby documentation shows off the basic functionality:url = 'https://medium.com/feed/@olegchursin/'open(url) do |rss| feed = RSS::Parser.parse(rss) puts "Title: #{feed.channel.title}" feed.items.each do |item| puts "Item: #{item.title}" endendThis parses the feed’s XML data into an object of class RSS::Rss and demonstrates calling #channel and #items to output the titles of the channel (Hi, Oleg!) and its recent articles:Title: Stories by Oleg Chursin on MediumItem: A Brief Introduction to Domain ModelingItem: Refactoring in RubyNow that we have the feed in a format Ruby can easily use, we can call the #items method on it, which returns an array containing the feed’s articles as objects of class RSS::Rss::Channel::Item, then call each Item’s methods to access title, description, creator, etc., and a link to the full article.All of this turned out to be much easier than I was expecting, and I wanted to play around with RSS a little more, so I started building some methods to interact with a feed, then created an RSSFeed class and a command line interface to navigate and display the feed’s contents and open full articles in a browser. A couple hours later I ended up with an RSS reader application. It’s still very basic, but I hope to build on it as I continue to expand my knowledge — next up is storing feeds, channels, and articles in a database, then perhaps displaying all of this on a webpage instead of in a terminal window.If you’re curious about seeing how I did all this it’s up on Github at the link below, and you can expect to see more posts here related to this project as I continue to build it.krandles/really-simple-rss

[Technology] 🌎 https://medium.com/@krandles/rss-and-ruby-its-really-simple-a32a8654733a?source=rss-d451d084d34a------2 [🧠] [v2] article_embedding_description: {:llm_project_id=>"Unavailable", :llm_dimensions=>nil, :article_size=>5162, :llm_embeddings_model_name=>"textembedding-gecko"}
[🧠] [v1/3] title_embedding_description: {:ricc_notes=>"[embed-v3] Fixed on 9oct24. Only seems incompatible at first glance with embed v1.", :llm_project_id=>"unavailable possibly not using Vertex", :llm_dimensions=>nil, :article_size=>5162, :poly_field=>"title", :llm_embeddings_model_name=>"textembedding-gecko"}
[🧠] [v1/3] summary_embedding_description:
[🧠] As per bug https://github.com/palladius/gemini-news-crawler/issues/4 we can state this article belongs to titile/summary version: v3 (very few articles updated on 9oct24)

🗿article.to_s

------------------------------
Title: RSS and Ruby — It’s Really Simple
[content]
No, really, it is…I’ve been using an RSS aggregator as my primary method of consuming news for about 10 years, so now that I’m learning how to do more with Ruby than just execute blocks of code, I thought I’d dig into how I can use Ruby to interact with an RSS feed and see just what I can do with it. As it turns out, it’s really quite simple.What is RSS?RSS, created by a couple engineers at Netscape back in the days when Netscape was still a thing, originally stood for Rich Site Summary (thanks, Wikipedia!) but is now known as Really Simple Syndication and it, along with the very similar Atom, is a standardized format for providing a feed of a website’s content, generally to be used by a feed aggregator, such as Feedly or the late, lamented Google Reader.There’s an xkcd for everything.If you’re not sure why this would be useful, well…just try keeping up with the content of a few dozen pages without using an aggregator. Sure, you could follow them all on Twitter or Google Plus (LOL), as long as you’re cool with an algorithm deciding which posts actually show up in your feed, but a good RSS aggregator will give you total control over your newsfeed and ensure that you never miss a post, to say nothing of the ability to turn a Craigslist or eBay search into a custom RSS feed.OK, so how does it work?An RSS feed is just an XML-formatted document, and if you’ve ever published a blog post then you’ve almost certainly published an RSS feed along with it, whether you were aware of it or now. Below is the RSS feed for this very blog, which you can see for yourself at https://medium.com/feed/@krandles.Since I’m in the middle of writing my first post here, it doesn’t actually contain any articles yet, but you can see it already provides some basic information about my blog, and we’ll take a look at an actual post a bit later on.First, let’s get into how we can use Ruby to scrape an RSS feed from a website and turn it into something we can work with.require ‘rss’A quick search of rubygems.org for “rss” returns a couple hundred results, but all we need to get started (along with open-uri, so Ruby can open webpages) is Ruby’s standard library, which provides the ability to produce and consume feeds via the RSS module:require 'rss'require 'open-uri'Trying out the example code provided in the Ruby documentation shows off the basic functionality:url = 'https://medium.com/feed/@olegchursin/'open(url) do |rss|  feed = RSS::Parser.parse(rss)  puts "Title: #{feed.channel.title}"  feed.items.each do |item|    puts "Item: #{item.title}"  endendThis parses the feed’s XML data into an object of class RSS::Rss and demonstrates calling #channel and #items to output the titles of the channel (Hi, Oleg!) and its recent articles:Title: Stories by Oleg Chursin on MediumItem: A Brief Introduction to Domain ModelingItem: Refactoring in RubyNow that we have the feed in a format Ruby can easily use, we can call the #items method on it, which returns an array containing the feed’s articles as objects of class RSS::Rss::Channel::Item, then call each Item’s methods to access title, description, creator, etc., and a link to the full article.All of this turned out to be much easier than I was expecting, and I wanted to play around with RSS a little more, so I started building some methods to interact with a feed, then created an RSSFeed class and a command line interface to navigate and display the feed’s contents and open full articles in a browser. A couple hours later I ended up with an RSS reader application. It’s still very basic, but I hope to build on it as I continue to expand my knowledge — next up is storing feeds, channels, and articles in a database, then perhaps displaying all of this on a webpage instead of in a terminal window.If you’re curious about seeing how I did all this it’s up on Github at the link below, and you can expect to see more posts here related to this project as I continue to build it.krandles/really-simple-rss
[/content]

Author: Kevin Randles
PublishedDate: 2017-12-21
Category: Technology
NewsPaper: Kevin Randles on Medium
Tags: rss, ruby, flatiron-school
{"id"=>4218,
"title"=>"RSS and Ruby — It’s Really Simple",
"summary"=>nil,
"content"=>"

No, really, it is…

I’ve been using an RSS aggregator as my primary method of consuming news for about 10 years, so now that I’m learning how to do more with Ruby than just execute blocks of code, I thought I’d dig into how I can use Ruby to interact with an RSS feed and see just what I can do with it. As it turns out, it’s really quite simple.

What is RSS?

RSS, created by a couple engineers at Netscape back in the days when Netscape was still a thing, originally stood for Rich Site Summary (thanks, Wikipedia!) but is now known as Really Simple Syndication and it, along with the very similar Atom, is a standardized format for providing a feed of a website’s content, generally to be used by a feed aggregator, such as Feedly or the late, lamented Google Reader.

\"\"
There’s an xkcd for everything.

If you’re not sure why this would be useful, well…just try keeping up with the content of a few dozen pages without using an aggregator. Sure, you could follow them all on Twitter or Google Plus (LOL), as long as you’re cool with an algorithm deciding which posts actually show up in your feed, but a good RSS aggregator will give you total control over your newsfeed and ensure that you never miss a post, to say nothing of the ability to turn a Craigslist or eBay search into a custom RSS feed.

OK, so how does it work?

An RSS feed is just an XML-formatted document, and if you’ve ever published a blog post then you’ve almost certainly published an RSS feed along with it, whether you were aware of it or now. Below is the RSS feed for this very blog, which you can see for yourself at https://medium.com/feed/@krandles.

\"\"

Since I’m in the middle of writing my first post here, it doesn’t actually contain any articles yet, but you can see it already provides some basic information about my blog, and we’ll take a look at an actual post a bit later on.

First, let’s get into how we can use Ruby to scrape an RSS feed from a website and turn it into something we can work with.

require ‘rss’

A quick search of rubygems.org for “rss” returns a couple hundred results, but all we need to get started (along with open-uri, so Ruby can open webpages) is Ruby’s standard library, which provides the ability to produce and consume feeds via the RSS module:

require 'rss'
require 'open-uri'

Trying out the example code provided in the Ruby documentation shows off the basic functionality:

url = 'https://medium.com/feed/@olegchursin/'
open(url) do |rss|
feed = RSS::Parser.parse(rss)
puts "Title: \#{feed.channel.title}"
feed.items.each do |item|
puts "Item: \#{item.title}"
end
end

This parses the feed’s XML data into an object of class RSS::Rss and demonstrates calling #channel and #items to output the titles of the channel (Hi, Oleg!) and its recent articles:

Title: Stories by Oleg Chursin on Medium
Item: A Brief Introduction to Domain Modeling
Item: Refactoring in Ruby

Now that we have the feed in a format Ruby can easily use, we can call the #items method on it, which returns an array containing the feed’s articles as objects of class RSS::Rss::Channel::Item, then call each Item’s methods to access title, description, creator, etc., and a link to the full article.

All of this turned out to be much easier than I was expecting, and I wanted to play around with RSS a little more, so I started building some methods to interact with a feed, then created an RSSFeed class and a command line interface to navigate and display the feed’s contents and open full articles in a browser. A couple hours later I ended up with an RSS reader application. It’s still very basic, but I hope to build on it as I continue to expand my knowledge — next up is storing feeds, channels, and articles in a database, then perhaps displaying all of this on a webpage instead of in a terminal window.

If you’re curious about seeing how I did all this it’s up on Github at the link below, and you can expect to see more posts here related to this project as I continue to build it.

krandles/really-simple-rss

\"\"",
"author"=>"Kevin Randles",
"link"=>"https://medium.com/@krandles/rss-and-ruby-its-really-simple-a32a8654733a?source=rss-d451d084d34a------2",
"published_date"=>Thu, 21 Dec 2017 03:20:48.000000000 UTC +00:00,
"image_url"=>nil,
"feed_url"=>"https://medium.com/@krandles/rss-and-ruby-its-really-simple-a32a8654733a?source=rss-d451d084d34a------2",
"language"=>nil,
"active"=>true,
"ricc_source"=>"feedjira::v1",
"created_at"=>Mon, 01 Apr 2024 20:13:24.819706000 UTC +00:00,
"updated_at"=>Mon, 21 Oct 2024 18:02:50.580075000 UTC +00:00,
"newspaper"=>"Kevin Randles on Medium",
"macro_region"=>"Technology"}
Edit this article
Back to articles