Skip to content

OPML to get all feeds of all categories #436

@sjehuda

Description

@sjehuda

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)

  • Yes, I have already written code for it (link if available and feasible)
  • Yes, I don’t have code ready yet (that’s okay!)
  • No (that’s okay too!)

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions