yinan-c / RSS-GPT

Using ChatGPT to summarize your personalized RSS feeds
https://yinan.me/rss-gpt-manual-en.html
MIT License
284 stars 98 forks source link

Allow import from OPML #22

Closed quinn-p-mchugh closed 6 months ago

quinn-p-mchugh commented 7 months ago

Hi there,

Incredibly cool use case - thanks for taking the time to create this!

I currently use Inoreader to aggregate all my RSS feeds, which allows me to export my RSS feeds in OPML format.

However, I see that RSS-GPT requires RSS feeds to be formatted in ini format, as shown below:

[source008]
name = "36kr-ai"
url = "https://rsshub.app/36kr/motif/327686782977"
max_items = "2"
filter_apply = "title"
filter_type = "include"
filter_rule = "OpenAI|ChatGPT"

Is there plans to allow the app to ingest an OPML file and apply settings to each RSS feed within it?

Without this feature, I suspect config management will be time intensive for users with large RSS libraries.

yinan-c commented 7 months ago

Hi, Thanks for your suggestion, that's actually a very good idea. What I can do is to write a parser for OPML file as a module that could be imported in the main.py. Unfortunately, in this way, I don't think there is a good way to implement the filter and the merge function efficiently. If you got any ideas, please let me know and I really appreciate it.

Alternatively, I can separate these two steps: Use the parser as a standalone script that generates or append to a .ini file from a OPML file. And users can then modify the .ini file themselves after the .ini file being generated. In that way, you can add a filter or merger to whatever feeds you like.

What do you think?

Either way, I'll have to do the work after next week when I have more time. But this is a very good suggestion, I will think about a good way to implement it and work on it soon.

quinn-p-mchugh commented 7 months ago

@yinan-c Thanks for considering!

Alternatively, I can separate these two steps: Use the parser as a standalone script that generates or append to a .ini file from a OPML file. And users can then modify the .ini file themselves after the .ini file being generated. In that way, you can add a filter or merger to whatever feeds you like.

This approach makes the most sense to me. While I haven't found a way to add additional metadata to OPML files, I believe that storing additional metadata within these files wouldn't be a good solution anyway.

With the above approach, users would be able to continually utilize an (unmodified) OPML file exported from whichever RSS aggregator they already use.

Should they wish to update their INI file based on a new OPML file (i.e. after adding some feeds to their RSS aggregator), it would simply entail comparing the new INI file with the old one in something like VS Code and adding/removing the appropriate sections.

yinan-c commented 7 months ago

@quinn-p-mchugh

Hi, I finally got the chance to take a look and I've uploaded a helper.py script that hopefully can do what you have in mind. Usage: python helper.py <opml_file> <ini_file>

Please try it out and let me know if it works. It should work for both appending to an existing file or write to a new file.

Note: for now, if you want to merge feeds, add filters, set summarization, you'll have to manually modify the ini file generated.

quinn-p-mchugh commented 6 months ago

Hi @yinan-c,

Apologies for the delay in response here!

Thank you for taking the time to develop this. I'll let you know once I get a chance to try it out!