getnikola / plugins

Extra plugins for Nikola
https://plugins.getnikola.com/
MIT License
56 stars 92 forks source link

OPML to get all feeds of all categories #436

Open sjehuda opened 3 months ago

sjehuda commented 3 months ago

Requested Feature: (short description)

It would be good to have feed per tag, and generate an OPML file to download all at once for easy import into feed readers.

Related Area: (eg. tasks, compilers, configuration, templates…)

I think template.

Do you want to contribute this yourself as a pull request? (don’t worry about it if you don’t want to/can’t — someone else can take care of it)

Does this feature affect backwards compatibility? If yes, in what way?

No

Rationale and full description: (why should it be added to Nikola?)

Some people would want to get information on a specific matter.

For instance, not all news of WebXDC may be relevant and Game developers would want to get WebXDC news concerning to games.

OPML

OPML can be used to download a collection of feeds at once.

As I did not find an OPML generator, I have wrote my own one:

def export_to_opml(jid, filename, results):
    print(jid, filename, results)
    function_name = sys._getframe().f_code.co_name
    logger.debug('{} jid: {} filename: {}'
                .format(function_name, jid, filename))
    root = ETR.Element("opml")
    root.set("version", "1.0")
    head = ETR.SubElement(root, "head")
    ETR.SubElement(head, "title").text = "{}".format(jid)
    ETR.SubElement(head, "description").text = (
        "Set of subscriptions exported by Slixfeed")
    ETR.SubElement(head, "generator").text = "Nikola"
    ETR.SubElement(head, "urlPublic").text = (
        "https://getnikola.com/")
    time_stamp = dt.current_time()
    ETR.SubElement(head, "dateCreated").text = time_stamp
    ETR.SubElement(head, "dateModified").text = time_stamp
    body = ETR.SubElement(root, "body")
    for result in results:
        outline = ETR.SubElement(body, "outline")
        outline.set("text", result[1])
        outline.set("xmlUrl", result[2])
        # outline.set("type", result[2])
    tree = ETR.ElementTree(root)
    tree.write(filename)

Source: https://gitgud.io/sjehuda/slixfeed/-/raw/master/slixfeed/action.py?ref_type=heads

Kwpolska commented 3 months ago

Feeds for categories/tags

Already exists: https://getnikola.com/categories/nikola.xml

Atom should work too, but it’s not enabled on getnikola.com.

OPML to get all feeds

This would be OK. Shouldn’t be too hard to implement if we would only have tags and categories in there.

sjehuda commented 3 months ago

Already exists: https://getnikola.com/categories/nikola.xml

Thank you. Title has been changed accordingly.

This would be OK. Shouldn’t be too hard to implement if we would only have tags and categories in there.

Do you want OPML to be in core?

If you do, since an Atom generation is within nikola.py shall we move it and OPML to syndication.py module?

Kwpolska commented 3 months ago

I think OPML should be a plugin.

sjehuda commented 3 months ago

Can we move this to plugins issue tracker?

Kwpolska commented 3 months ago

Moved.