Giter VIP home page Giter VIP logo

django-yarr's Introduction

Django Yarr - Yet Another RSS Reader

A lightweight customisable RSS reader for Django.

https://codecov.io/gh/radiac/django-yarr/branch/develop/graph/badge.svg?token=5VZNPABZ7E

Features

  • Easy to install - simple requirements, just drops into your site
  • Import and export list of feeds using OPML
  • View all, by feed, just unread or saved items
  • List or expanded layout
  • Mark items as read or saved
  • Infinite scrolling, with keyboard support and automatic mark as read
  • Support for multiple users
  • Manage subscriptions through user views or admin site
  • No social nonsense

Supports Django 2.2 and later, on Python 3.5 and later.

See Installation for installation instructions.

See Upgrading for changelog and upgrade instructions

django-yarr's People

Contributors

bichanna avatar chrisfranklin avatar dependabot[bot] avatar growse avatar radiac avatar sherzberg avatar tiktuk avatar twm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-yarr's Issues

unexpected keyword argument 'namedtuple_as_object'

I've got this error just after installation.

Request Method: GET
Request URL: http://10.0.3.171:8080/unread/
Django Version: 1.6.4

Traceback:
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py" in get_response
1.                     response = wrapped_callback(request, _callback_args, *_callback_kwargs)
   File "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/decorators.py" in _wrapped_view
2.                 return view_func(request, _args, *_kwargs)
   File "/srv/src/django-yarr/yarr/views.py" in list_entries
3.                     ENTRY_SAVED:    reverse('yarr-list_saved', kwargs={'feed_pk':'00'}),
   File "/srv/src/django-yarr/yarr/utils.py" in jsonEncode
4.     return simplejson.dumps(data, cls=DjangoJSONEncoder)
   File "/usr/lib/python2.7/dist-packages/simplejson/**init**.py" in dumps
5.         **kw).encode(obj)

Exception Type: TypeError at /unread/
Exception Value: **init**() got an unexpected keyword argument 'namedtuple_as_object'

Don't report CharacterEncodingOverride as a feed error

I have lots of feeds that sport a yellow triangle and this message:

Feed error: CharacterEncodingOverride - document declared as us-ascii, but parsed as utf-8

I don't think it should mark the feed as having a problem because:

  1. The feed continues to work, so the user doesn't need to take any action;
  2. There's not really anything that a user can do (aside from complain to the site owner, who will probably just ignore them).

Mark all read doesn't always work

When there are a lot of entries for the current feed, mark all read sometimes doesn't work.

This is because it is currently passed a list of PKs to modify; when the list is too large, the request can fail when Django tries to filter by them all (maximum number allowed).

Could fix by marking in chunks, or change the API to use the current feed and latest PK.

models error

ERRORS:
yarr.Feed: (models.E020) The 'Feed.check()' class method is currently overridden by <funciton Feed.check at 0x000001CE396EB950>

I am getting the above warning when I am running the "python manage.py migrate" process. Could you please help?

Duplicate post consolidation

I would like to add a feature to the way the entries are displayed. There are some news sites (NYTimes, NPR) that have a number of RSS feeds. There are specific topic feeds and general feeds. There are sometimes articles that overlap and show up, identically, in multiple feeds. This causes those articles to show up multiple times in the feed list, even though they are essentially the same article.

I'm thinking of adding a hash to each of the entries that is based on the entry title, content, and possibly the link. These hashes would then be used to consolidate items in the aggregate lists (unread, starred, all).

Would you be interested in this feature?

Yarr's incompatibilty with Django "custom User model"

Yarr seems to be not compatible with the "custom User model" feature introduced in Django since version 1.5

My case:
In my project I am using a custom User model, correctly configurated, and all works. Now I need a RSS reader for Django, and I tried to installed Yarr.
After following all the steps in the installation guide, the command

django-admin.py migrate yarr

raised this error:

CommandError: One or more models did not validate:
yarr.feed: 'user' defines a relation with the model 'auth.User', which has been swapped out. Update the relation to point at settings.AUTH_USER_MODEL.

(even using syncdb raised the same error)

I think the problem is here:
https://github.com/radiac/django-yarr/blob/master/yarr/models.py#L106

Maybe a solution like the one used in django-registration could be perfect:

#### put this block just after the import lines
try:
    from django.contrib.auth import get_user_model
    User = get_user_model()
except ImportError:
    from django.contrib.auth.models import User
####

# nothing changes until line 106
...
... 
...

user = models.ForeignKey(User) # replace line 106

No button to remove RSS handler from Firefox

Although there is a button to register yarr as an RSS content handler, there is no button to unregister. The button also doesn't detect whether yarr has already been added. As far as I am aware, neither are possible - instead, this issue is here for anyone who wants to remove yarr from their "Subscribe to this feed using" list.

To remove the yarr RSS handler from Firefox:

  1. Go to Tools -> Preferences
  2. Switch to the Applications tab
  3. Scroll to Web Feed, and select Application Details... from the drop-down
  4. Click on the application you want to remove, and click Remove, then OK

Links should open in new tab

The linked heading of each entry opens in a new tab, but links in the body of entries don't. Yarr should force <a target=_blank> so that off-site links consistently open in a new tab.

error when comparing datetimes

After adding: https://news.ycombinator.com/rss I got this error:

python manage.py check_feeds
Traceback (most recent call last):
  File "manage.py", line 10, in 
    execute_from_command_line(sys.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/srv/src/django-yarr/yarr/decorators.py", line 19, in wrap
    r = fn(*args, **kwargs)
  File "/srv/src/django-yarr/yarr/management/commands/check_feeds.py", line 79, in handle
    logfile=self.stdout if options['verbose'] else None,
  File "/srv/src/django-yarr/yarr/managers.py", line 26, in check
    feed.check(force, read, logfile)
  File "/srv/src/django-yarr/yarr/models.py", line 274, in check
    changed = self._do_check(force, read, logfile)
  File "/srv/src/django-yarr/yarr/models.py", line 301, in _do_check
    and self.next_check >= next_poll
TypeError: can't compare offset-naive and offset-aware datetimes

Adaptive feed check frequency

My current plan for this:

  • Drop the Feed.check_frequency model attribute and settings.FREQUENCY
  • Add Feed.calculate_next_check() method, which would get a flat list of the feed's entries' date values, and use them to guesstimate how long it would be until the next entry might appear.
  • Some statistical operation would be needed for that - perhaps discard outliers, add the current date, then pick the mean? Or is that too naive?
  • Apply bounds on the value (settings.MINIMUM_INTERVAL and settings.MAXIMUM_INTERVAL)
  • Change Feed._do_check so that self.next_check = self._calculate_next_check()

At least some default page working

When I do everything needed and the only result I get is " Yeah Django!
let's admin " (yes, admin works) is kind of anti-climactic. I understand that in the Django-world people usually do not expect application to work, but still.

Load feed when added

It would be good to add an option to import a feed as part of the submit process in views.feed_form; we could check that the feed exists, show any parse warnings, and immediately load feed title and other details, and if all is well, take the user back to see the feed entries straight away.

However, feedparser currently doesn't provide a way to allow timeouts in a thread-safe manner, and they have been resistant to adding it as an option in the past, although have suggested that they would be open to a new function. They should be contacted to see what they would accept.

Once this has been done, we can remove decorators.with_socket_timeout.

The other approach would be to add a boolean setting, eg YARR_THREADSAFE, to enable/disable the fetch functionality, but patching feedparser would be the better option.

Media rendering

I plan to address the three rendering issues in the roadmap by contributing a patch to bleach to support tag callables (in a similar way to their attribute callables).

That should allow us to efficiently convert and sanitise img tags and youtube embeds into a tags with the resource address on the href, specifying the media type as a data-yarr-media="(img|youtube)" attribute.

The javascript can then lazy-load them, improving render times and allowing future support for safely allowing arbitrary embeds.

(Issue opened in case it helps anyone who gets on to this before me)

__init__() got an unexpected keyword argument 'mimetype'

I tried to export my feeds via http://localhost:8000/yarr/feeds/export/
The following error raised:

Request Method: GET
Request URL: http://localhost:8000/yarr/feeds/export/

Django Version: 3.2.7
Python Version: 3.8.10
Installed Applications:
[
 'yarr',
 'django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles']
Installed Middleware:
['django.middleware.security.SecurityMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']



Traceback (most recent call last):
  File "/media/kalle/Sprachdaten/yarr/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/media/kalle/Sprachdaten/yarr/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/media/kalle/Sprachdaten/yarr/lib/python3.8/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/media/kalle/Sprachdaten/yarr/lib/python3.8/site-packages/yarr/views.py", line 412, in feeds_export
    response = HttpResponse(utils.export_opml(request.user), mimetype="application/xml")
  File "/media/kalle/Sprachdaten/yarr/lib/python3.8/site-packages/django/http/response.py", line 329, in __init__
    super().__init__(*args, **kwargs)

Exception Type: TypeError at /yarr/feeds/export/
Exception Value: __init__() got an unexpected keyword argument 'mimetype'

Feed list scrolls to the top on click

Recreate: scroll down a long feed list, click a feed, the page will reload with the list scrolled to the top.

This is because the page reloads. Could hack it to remember scrollTop using cookies/params, but would be better to move it all to single page dynamic loading.

Will address once list_entries.js refactor is complete.

import_opml functionalty raises 'ExpatError: not well-formed' for valid XML containing funky chars

The following xml generates an error condition when using import_opml. Looks like an issue with the Expat XML parser:

<?xml version="1.0" encoding="UTF-8"?>
<opml version="1.0">
    <head>
        <title>Wibble wibble pop</title>
    </head>
    <body>
        <outline text="Ajaxian » Front Page"
            title="jaxian » Front Page" type="rss"
            xmlUrl="http://ajaxian.com/index.xml" htmlUrl="http://ajaxian.com"/>
    </body>
</opml>

Output:

$ ./manage.py import_opml subs.xml andrew
Importing feeds...
ExpatError: not well-formed (invalid token): line 9, column 31

Pip freeze:

Django==1.5.1
South==0.8.1
argparse==1.2.1
bleach==1.2.2
-e git+https://github.com/radiac/django-yarr.git@0ea02141a2e610f5cfa2117f06ffad815a5f18ba#egg=django_yarr-dev
feedparser==5.1.3
html5lib==1.0b2
psycopg2==2.5.1
six==1.3.0
wsgiref==0.1.2

Include a ready to use yarr site

What would you think about adding adding an example directory with a basic django project
with the settings, urls and templates configured for yarr?
That would make it easier for people to try your application without having any knowledge about
Django.

Supported browsers?

When contributing it would be nice to know what sort of browser support we need to aim for. For example, the positioning of .yarr_control currently done with JS could be done in pure CSS with position: sticky if it's not important to support some older browsers.

Likewise, browser-local prefs that are currently stored in cookies would be better placed in localStorage provided IE 8 isn't a factor---please tell me IE 8 isn't a factor, please...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.