Fetching RSS feeds into Tinderbox one item per feed item


(Christian) #1

Hello!

I try to include a RSS feed into Tinderbox. Ideally one note per RSS item. I checked the old forum and could not find a source how that would work. The user manual did not help me either. I should have a HTML tab under document settings, which does not exists.

So is there a way I can fetch on opening Tinderbox all latest items of a RSS feed note by note?

Thanks for any hints.


(Paul Walters) #2

The “user manual” page you linked to dates back 7 years and applies to Tinderbox 5. If you have Tinderbox 6, this will not work. The attributes (and, I believe, the RSS import feature) are not present in Tinderbox 6.


(Christian) #3

Thanks for the hint. Do you maybe know of any API request I can run with an agent? Basically I only want Tinderbox to pull somehow data from the Internet.


(eastgate) #4

There are a variety of approaches you might take.

You could import the raw RSS easily enough by placing the URL in $URL and setting $AutoFetch to true. That will strip tags and give you a rough-and-ready copy of the feed, which may be suitable for Explode.

Or, you could use runCommand to fetch the XML data with curl and then pass it along to a script that would extract just what you want.

Or, you could try scripting an XML reader like NetNewsWire through runCommand.

Or, you might try processing the RSS feed through a mashup service like Zapier and then use its output.

Much depends on precisely what you want to accomplish, and what tools you prefer to use.


(Christian) #5

Thank you Mark.

I decided to work with the runCommand and wrote a Python script that reads my feed. See below. By the way somehow Tinderbox does not see my python packages and that’s why I have to load it extra.

Here is my idea:
First I load the json content through a stamp in a note. Now I thought I would create an agent that reads out the json result and creates new notes for each item. Does that makes sense or is it a redundant task? I just cannot get my head around the agent query to start creating notes. I browsed unsuccesfully the forum for a long time to find some hints how I can create notes from an input (e.g. json).

And I would add the ID to avoid duplicated items.

$Text = runCommand(‘python ~/get_feeds_pinboard.py’)

import sys
sys.path.append(’/usr/local/lib/python2.7/site-packages’)
import feedparser
feed_url = "https://feeds.pinboard.in/rss/"
def main(feed_url):
d = feedparser.parse(feed_url)
for item in d.entries:
print item
if name == “main”:
main(feed_url)


Bulk remove notes
(Christian) #6

Okay I solved it. I did not know that agents cannot create new notes.

Therefore I work with text files and then add these files to Tinderbox, which are then processed by the following agent:

$Name.contains("file__") & $Text.contains("(<title>)(.*)(</title>)") & $Text.contains("(<tags>)(.*)(</tags>)") & $Text.contains("(<url>)(.*)(</url>)")

$Name=$3;$Tags=$7;$Prototype="Pinboard";$URL=$11;

PS: The forum software seems to format the first query wrong.


(Paul Walters) #7

When entering code here try using the “pre-formatted text” option on the editor toolbar or select the text and press ⇧⌘C