Ruby Rss analyzer and event trigger

I use the RSS library so that I can parse Atom and RSS in Ruby and Rails and store them in a model. I looked through the standard RSS library, but is there one library that will automatically detect that there is a new rss feed so that I can update my database?

What is the best practice to run instructions to store a new RSS feed? Should I use threads to solve this problem? Will it be slow? thank you for your help

+3
source share
3 answers

OK makes a deal.

+10

, " " ?

, , - ? , , ?

, , , - . google " rss-" , , . , . URL-, RSS/Atom . - , (RDF, RSS Atom), , , .

, , , , , , , . . , , . , , .

, crontab Linux Unix- , , .

?

+1

-

When you populate your model with RSS feed data, use Model.create (...) instead Model.find_or_create_by_column(value, :other_column => other_value).

You can specify the date as a unique value or the title of the RSS message ... (whatever you wish)

I think this is pretty easy. For example, you can perform some cron task to populate your model once per hour. Only new channels will be added.

It is not possible to receive any β€œevent” when RSS is being updated without loading the entire RSS feed again.

+1
source

Source: https://habr.com/ru/post/1741635/


All Articles