radiac / django-yarr Goto Github PK
View Code? Open in Web Editor NEWA lightweight customisable RSS reader for Django.
Home Page: https://radiac.net/projects/django-yarr/
License: Other
A lightweight customisable RSS reader for Django.
Home Page: https://radiac.net/projects/django-yarr/
License: Other
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
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 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
Is this method supposed to be empty? I suspect that this is causing the period resurfacing of some entries back to unread status, seemingly at random.
https://github.com/radiac/django-yarr/blob/master/yarr/models.py#L456
The mark all read button should only mark the items on the current view,
not all of the things.
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...
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.
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.
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.
The management UI exposes the feed title as an editable field, but if you change it it just gets clobbered on the next update.
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.
The check()
method on the Feed
class conflicts with a Django 1.7 classmethod. See https://code.djangoproject.com/ticket/22526.
It results in this traceback message:
TypeError: unbound method check() must be called with Feed instance as first argument (got nothing instead)
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.
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'
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.
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:
Is this supposed to be possible at all? If not, why are saved and read separate model fields, rather than a {UNREAD, SAVED, READ} enumeration?
When a feed includes a <style>
tag, the tag is stripped but its content remains. An example of this is the PyPy status blog (the feed content appears to contain a reStructuredText stylesheet.
This will probably be difficult to fix until mozilla/bleach#67 is.
Lots of feed readers have the ability to group feeds by "categories" or "tags". Do you have any interest in a feature like this?
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?
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'
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
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:
Tools
-> Preferences
Applications
tabWeb Feed
, and select Application Details...
from the drop-downRemove
, then OK
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)
My current plan for this:
Feed.check_frequency
model attribute and settings.FREQUENCY
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.settings.MINIMUM_INTERVAL
and settings.MAXIMUM_INTERVAL
)Feed._do_check
so that self.next_check = self._calculate_next_check()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.