lkiesow / python-feedgen

Python module to generate ATOM feeds, RSS feeds and Podcasts.
https://feedgen.kiesow.be/
BSD 2-Clause "Simplified" License
723 stars 123 forks source link

Add new content to existing RSS file #72

Open 6a7070 opened 6 years ago

6a7070 commented 6 years ago

Does this library offer a way to add entries to existing RSS files? I am able to generate new RSS files and append items to it during the initial setup of the file. However, when I don't see a mechanism to read a file, add content, and then resave. Am I missing something obvious? Thanks.

conrad784 commented 6 years ago

take a look at issue32, so no, until you provide a patch for it, I would be happy to have this too :)

karlcow commented 4 years ago

some experiments, and inspiration

https://github.com/leonardr/botfriend/blob/6157a873c4158ccfdda4bf021059bddf14217654/botfriend/feedbridge.py

https://github.com/csernazs/misc/blob/b3b4c7d8b40795a0e99480d744e574a04819425a/rssfilter/rssfilter.py

which is about basically using feedparser to parse and reassign each variables to the feedgen model.

ispringle commented 4 years ago

I do understand the desire to import an existing feed and create a feedgen object out of that, however an alternative solution would be to just use pickle and save the object, then load it again when needed. I'm doing this with my own use of feedgen and it works well.

Once you have your fg object ready to save just do:

with open('feed.obj', 'wb') as f:
    pickle.dump(fg, f)

And to reload the object later:

with open('feed.obj', 'rb') as f:
    fg = pickle.load(f)

Might be handy to document this for others somewhere.

nzjc commented 3 years ago

I do understand the desire to import an existing feed and create a feedgen object out of that, however an alternative solution would be to just use pickle and save the object, then load it again when needed. I'm doing this with my own use of feedgen and it works well.

Once you have your fg object ready to save just do:

with open('feed.obj', 'wb') as f:
    pickle.dump(fg, f)

And to reload the object later:

with open('feed.obj', 'rb') as f:
    fg = pickle.load(f)

Might be handy to document this for others somewhere.

Legend.