Coder Social home page Coder Social logo

feedformatter's People

Contributors

alertedsnake avatar lmaurits avatar marianoguerra avatar

Watchers

 avatar

Forkers

kartones-tkt

feedformatter's Issues

tighter compatibility with feedparser

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

date formatting breaks in non-US locale

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

Wrong handling of strings in _convert_datetime

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:

Add html to description?

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>&lt;img src='http://foo.com/nxwquMosquito.png'&gt; Safety tips to..


Linux, Python 2.7


Original issue reported on code.google.com by [email protected] on 30 Jul 2013 at 5:08

_convert_datetime doesn't parse

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

_atomise_link doesn't work if link is a dict.


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

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.