Package: django-feed-reader
Django Feed ReaderThis is a simple Django module to allow you subscribe to RSS (and other) feeds.This app has no UI, it just reads and stores the feeds for you to use as you see fit.This app builds on top of the FeedParser library to provide feed management, storage, scheduling etc.FeaturesConsumes RSS, Atom and JSONFeed feeds.Parses feeds liberally to try and accomodate simple errors.Will attempt to bypass Cloudflare protection of feedsSupports enclosure (podcast) discoveryAutomatic feed scheduling based on frequency of updatesInstallationdjango-feed-readeris written in Python 3 and supports Django 2.2+pip install django-feed-readerAddfeedsto yourINSTALLED_APPSSetup some values insettings.pyso that your feed reader politely announces itself to servers:SetFEEDS_USER_AGENTto the name and (optionally version) of your service e.g."ExampleFeeder/1.2"SetFEEDS_SERVERto preferred web address of your service so that feed hosts can locate you if required e.g.https://example.comSetup a mechanism to periodically refresh the feeds (see below)Basic ModelsA feed is represented by aSourceobject which has (among other things) afeed_url.Sources havePostswhich contain the content.Postsmay haveEnclosures which is what podcasts use to send their audio.  The app does not download enclosures, if you want to do that you will need to it in your project using the url provided.A full description of the models and their fields is coming soon (probably).  In the mean  time, why not readmodels.py, it's all obvious stuff.Refreshing feedsTo conserve resources with large feed lists, the app will adjust how often it polls feeds based on how often they are updated.  The fastest it will poll a feed is every hour. The slowest it will poll is every 24 hours.Feeds that don't get updated are polled progressively more slowly until the 24 hour limit is reached.  When a feed changes, its polling frequency increases.You will need to decided how and when to run the poller.  When the poller runs, it checks all feeds that are currently due.  The ideal frequency to run it is every 5 - 10 minutes.Polling with cron.Set up a job that callspython manage.py refreshfeedson your desired schedule.Be careful to ensure you're running out of the correct directory and with the correct python environment.Polling with celeryCreate a new celery task and schedule in your app (see the celery documentation for details).  Yourtasks.pyshould look something like this:fromceleryimportshared_taskfromfeeds.utilsimportupdate_feeds@shared_taskdefget_those_feeds():# the number is the max number of feeds to poll in one goupdate_feeds(30)Tracking subscribers and read/unread state of feedsThe app does not (currently) track the read/unread state of posts within a feed.  That will need doing in your project according to your needs.The app assumes that each feed only has one subscriber that is the project itself.  If your project can allow personal subscriptions for individual users, you can let the app know on per feed basis how many subscribers it has by settingsnum_subson aSourceobject.
The app will then report this via the user agent to the feed source for analytics purposes.Dealing with CloudflareDepending on where you run your server, you may run into problems with Cloudflare's web captcha.  Plenty of sites out there set up their Cloudflare to have default security on their RSS feed and this can block server-side RSS readers.It's a huge pain and affects lots of self-hosted RSS readers. Seriously, Google it.django-feed-readerwill do it's utmost to get these feeds anyway through the judicious use of public proxy servers, but is haphazard and you cannot rely on the scheduling of such feeds.Feeds blocked by Cloudflare will have theis_cloudflareflag set on theirSourceand will update on a best-efforts basis.