lmaurits / feedformatter Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/feedformatter
License: Other
Automatically exported from code.google.com/p/feedformatter
License: Other
hi,
i've started looking at rss formatters and yours stood out amongst the
crowd. i like that feedformatter is designed to be compatible with
feedparser, but i think the compatibility could be made a bit tighter.
for example, a user should be able to instantiate a Feed class directly
from a parsed feedparser structure. ideally, it might look like this:
feed = feedformatter.Feed( **feedparser.parse(ERROR_FEED) )
it looks like to do this, you would need to implement several keywords on
Feed.__init__:
bozo, encoding, entries (alias for items), feed, namespaces, and version
unfortunately, i have very limited experience with feedparser, so i don't
know exactly what to do with this info on the feedformatter side or i would
do it myself. however, it does seem that the version keyword would allow
the addition of 'format_file' and 'format_string' functions which would use
the passed version to redirect to the appropriate formatting functions.
lastly, since this module is intended to be used with feedparser, your
example code should show how to do this.
thanks for the module.
-chad
Original issue reported on code.google.com by [email protected]
on 28 Sep 2009 at 6:13
What steps will reproduce the problem?
1. set locale to de-DE
2. generate rss2 feed with 1 item with any pubDate
3. try to display the feed with e.g. firefox
What is the expected output? What do you see instead?
expected: RFC822 date
actual: date string with localised month and weekday names
Proposed patch:
from datetime import datetime
from email.util import formatdate
in _format_datetime:
# Then, convert that to the appropriate string
if feed_type is "rss2":
return formatdate(mktime(time))
elif feed_type is "atom":
return datetime.utcfromtimestamp(mktime(time)).isoformat()
Original issue reported on code.google.com by [email protected]
on 17 Jul 2013 at 6:41
Adding it would be nice.
Original issue reported on code.google.com by [email protected]
on 26 Jan 2014 at 1:21
I'm trying to read a RSS feed with feedparser and update it with
feedformatter to add a few entries in it.
When creating the output file, feedformatter fails with the following message:
File "/usr/lib/python2.6/site-packages/feedformatter.py", line 163, in
_convert_datetime
raise Exception("Unrecongised time format!")
The string that it can't convert is an Unicode string previously created
with feedformatter. It's something like "Tue, 17 Nov 2009 15:21:46 CET",
which is *not* alphanumeric, so "time.isalnum()" fails. (And since
"strptime()" is not imported from the "time" module, it wouldn't work anyway.)
Here is a patch that fixes this bad behaviour. It also uses
types.StringTypes for a (possibly) better Unicode support.
Original issue reported on code.google.com by [email protected]
on 17 Nov 2009 at 2:57
Attachments:
What steps will reproduce the problem?
1. I'd like to add an image to my description.
2. My description like looks like this: item["description"] = "<img src='" +
img + "'> " + ' '.join(article.text.split("\n")[1:])
What is the expected output? What do you see instead?
I expect:
<description><img src='http://foo.com/nxwquMosquito.png> Safety tips to..
I get:
<description><img src='http://foo.com/nxwquMosquito.png'> Safety tips to..
Linux, Python 2.7
Original issue reported on code.google.com by [email protected]
on 30 Jul 2013 at 5:08
What steps will reproduce the problem?
1. Have Mon, 01 Oct 2012 11:24:00 +0000 in your atom feed as published
2. try smth like feedformatter.Feed(feed=feedparser.parse().feed).atom_string
3. see it fail
Exception: Unrecongised time format! local Mon, 01 Oct 2012 11:24:00 +0000
Note that I had to pimp the exception in _convert_datetime. Please consider
giving more helpful messages.
The strptime format currently is: "%a, %d %b %Y %H:%M:%S %Z"
time.strptime yields:
ValueError: time data '%a, %d %b %Y %H:%M:%S %Z' does not match format u'Mon,
24 Sep 2012 12:20:27 +0000'
No idea why it doesn't parse. But it's annoying.
Original issue reported on code.google.com by [email protected]
on 3 Oct 2012 at 1:47
proposed patch:
in _convert_datetime:
(...)
elif hasattr(time, 'timetuple'):
# datetime.datetime object
return time.timetuple()
Original issue reported on code.google.com by [email protected]
on 17 Jul 2013 at 6:37
if the link is a dict, the dict type is returned. It should return the link.
--- feedformatter.py~ 2009-10-09 00:38:00.000000000 +0200
+++ feedformatter.py 2009-10-09 01:17:41.000000000 +0200
@@ -182,7 +182,7 @@
def _atomise_link(link):
if type(link) is dict:
- return dict
+ return link
else:
return {"href" : link}
Original issue reported on code.google.com by jens.quade
on 8 Oct 2009 at 11:22
Can you please make a new release on PyPi with the latest changes. The PyPi one is Python 2 only, and trying to pip install on a python 3 system breaks. It looks like the change is in the git repo, just not on https://pypi.python.org/pypi/feedformatter/
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.