Action

RSS List to OMPL

Posted by @sylumer, Last update over 3 years ago - Unlisted

Steps

  • script

    //Set some OPML and RSS Feed entry warpper constants
    const OPML_PREFIX = `<opml version="2.0">
    	<body>
    		<outline text="Subscriptions" title="Subscriptions">
    `;
    const OPML_SUFFIX = `		</outline>
    	</body>
    </opml>`;
    const RSS_PREFIX = `			<outline xmlUrl="`;
    const RSS_SUFFIX = `" />
    `;
    
    //Initialise the OPML
    let strOPML = OPML_PREFIX;
    
    //For each line, if it has content add it as an RSS feed entry to the OPML
    let arrFeeds = draft.content.split("\n");
    arrFeeds.forEach(function(rssFeed)
    {
    	if (rssFeed.length > 0)
    	{
    		strOPML += RSS_PREFIX + rssFeed + RSS_SUFFIX;
    	}
    });
    
    //Complete the OPML
    strOPML += OPML_SUFFIX;
    
    //Create a new draft containing th OPML
    let draftOPML = Draft.create();
    draftOPML.content = strOPML;
    draftOPML.update();
    
    //Load the new draft
    editor.load(draftOPML);
    editor.activate();

Options

  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.