manolomartinez / greg

A command-line podcast aggregator
GNU General Public License v3.0
297 stars 37 forks source link

Can't sync with SpyCast #35

Closed n8willis closed 8 years ago

n8willis commented 8 years ago

I've encountered an issue with the "SpyCast" feed (url: http://feeds.spymuseum.org/spycast/ ) that prevents greg from 'sync'ing. It throws this error:

Checking SpyCast... Traceback (most recent call last): File "/usr/local/bin/greg", line 11, in sys.exit(main()) File "/usr/local/lib/python3.4/dist-packages/greg/gregparser.py", line 112, in main args.func(vars(args)) File "/usr/local/lib/python3.4/dist-packages/greg/greg.py", line 752, in sync feed.fix_linkdate(entry) File "/usr/local/lib/python3.4/dist-packages/greg/greg.py", line 252, in fix_linkdate entry.linkdate = list(entry.published_parsed) TypeError: 'NoneType' object is not iterable

I have been able to download individual episodes from this podcast successfully with greg. I also have a -d date set on it, though I have the same date set on several other feeds and they don't exhibit this problem. It looks like greg is having trouble parsing a date -- is this yet-another-quirky-feed?

manolomartinez commented 8 years ago

Hi, no, this feed appears to be mostly fine. There is just a typo in the date of the offending entry, which reads "Tue, 207Oct 2015 10:30:00 EST". Feedparser, and then greg, chokes on the Oct 207 thing :). If you avoid the entry titled 'Special Breed of Warrior: An Interview with Former SEAL Clinton Emerson', it should work fine.

Anyway, greg should probably be more resilient to this kind of problems. I'll think about how to do this. Thanks for reporting!

ghost commented 8 years ago

Perhaps sanitize the date with something like dateutil then if you can't verify the date format, then get the date of the previous feed entry and increment that date by 1 day and use that as the date for the problematic feed entry. Perhaps notify the user of the change, demonstrate why the feed item date was change, and notify of the string which threw the error.

manolomartinez commented 8 years ago

Actually, feedparser takes care of the parsing for us, and it does an excellent job at that. But yeah, the second part of your suggestion looks sensible to me. I'll try to get to it later this week.

ghost commented 8 years ago

Does https://github.com/manolomartinez/greg/commit/73152e147b25f129c4238515f4a892e90adac989 address this?

manolomartinez commented 8 years ago

It does, for the time being. A more general solution would be preferable, though -- I'm working on it.