Skip to content

Adding feeds

Alex Musayev edited this page Aug 27, 2021 · 18 revisions

How to add a new feed:

  • Add new feed to config/feeds.yml

  • Create private group on https://candy.freefeed.net/groups/create

  • Create private group on https://freefeed.net/groups/create

  • Update group description and avatar.

  • Create or reuse processor class.

  • Create or reuse normalizer class.

  • Add new feed test to test/feeds.

  • Create feed fixture at test/fixtures/files/feeds

    wget -O test/fixtures/files/feeds/oglaf.xml https://feeds.feedburner.com/oatmealfeed

    or

    curl https://lobste.rs/t/ruby.rss | pbcopy
  • Create normalized entiry expectation at test/fixtures/files/entities

  • Test new feed processing on staging.

  • Deploy to production.

  • ⚠️ Open public access for the new group.

Testing new feed:

feed = Feed.find_by(name: 'xkcd')

loader = LoaderResolver.call(feed)
processor = ProcessorResolver.call(feed)
normalizer = NormalizerResolver.call(feed)

content = loader.call(feed)
entities = processor.call(content, feed: feed)
entity = entities.first
normalized = normalizer.call(entity)
ap normalized.as_json

Test run background jobs for a specific feed:

bundle exec rails feeder:pull[einzelganger]
Clone this wiki locally