gpodder / podcastparser

Simplified, fast RSS parsing library in Python
ISC License
135 stars 35 forks source link

understand atom updated field as published #4

Closed elelay closed 7 years ago

elelay commented 7 years ago

Looks like it's the way to do it in podcastparser. I need this for https://www.c3d2.de/news-atom.xml otherwise I get published = 1 jan. 1970

elelay commented 7 years ago

For atom, updated is mandatory, published optional, according to the spec,

thp commented 7 years ago

Looks like the unit tests fail:

----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/travis/virtualenv/python3.6-dev/lib/python3.6/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/travis/build/gpodder/podcastparser/test_podcastparser.py", line 46, in test_parse_rss
    assert_equal(expected, parsed)
AssertionError: {'episodes': [{'description': '', 'enclosur[239 chars]eed'} != {'title': 'Example Feed', 'episodes': [{'de[239 chars]a'}]}
  {'episodes': [{'description': '',
                 'enclosures': [],
                 'guid': 'urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a',
                 'link': 'http://example.org/2003/12/13/atom03',
                 'payment_url': None,
-                'published': 1071336602,
?                                  ^^^
+                'published': 1071340202,
?                                  ^^^
                 'title': 'Atom-Powered Robots Run Amok',
                 'total_time': 0}],
   'title': 'Example Feed'}

Can you fixup the test data?

thp commented 7 years ago

Looks like there's still some timezone offset, but then it should be good to go in once that's fixed.

elelay commented 7 years ago

That's 1 less todo :-) Couldn't make the tests pass locally and on travis without tz

thp commented 7 years ago

Cool, thanks :)