Simple RSS issues - media:content url attribute

I searched the forum but this is a bit technical so I didn’t find any solution.

What I’m trying to do

I’m using the fairly excellent Simple RSS plugin to pull feeds into Obsidian folders, with each post creating a new file in Obsidian. It’s working well overall, I’m using it with a Grav feed and a Mastodon feed. I’m using the generic feed template (with some additions) for the Grav feed, and a custom feed type for the Mastodon feed.

Problem: Mastodon feed media:content url attribute

I’m trying to pull the url attribute from a media:content child item in a Mastodon feed to parse as an image (using html img tag) in an Obsidian markdown file. I cannot work out how to pull the url out of the media:content item and call it in the template, which is a json file “data.json”. Nb I have several other feed tags populating the markdown nicely from this feed, include feed and item values.

Things I have tried

I’ve tried a ton of solutions none of which work, eg

  • using square brackets round the media:content listed in item type
  • appending .url to media:content in both the template code and the item type
  • different ways of adding it to the list in main.js file.

Nb I had to add ‘description’ to the list of item types in main.js before either of the feeds would render the description text.

I’ll add code to this post when I’m back at my desk!

As I dont seem to be able to edit/update the original post (???), here’s the code Im currently using in the template. The hello h1 is only there to test the html parsing. Note the img src for &feed.webfeeds:icon, this works fine. So Im trying to use that with the media:content.url. This is not working - it returns nothing.

"template": "<h1>Hello</h1>\n<img src=\"{{&feed.webfeeds:icon}}\" width=\"100\" height=\"100\" />\n{{&item.guid}}\n{{&item.pubDate}}\n{{&item.description}}\n{{&item.categories}}\n\n<img src=\"{{&}}\">"

In the specified item types for the custom feed type im currently using this, all other item types work, only ["media:content", "url"] does not. Its probably not correct to use square brackets, or to use the url specifically, but Ive tried it multiple times as only "media:content"

      "item": [
        ["media:content", "url"],

UPDATE: the solution to targeting the media:content url attribute

I was in touch with the plugin dev and they sorted it - to target the url attribute use a $. This info has been added to the ReadMe in github for the Simple RSS plugin.

In case useful to others:

To target the url:

To display nicely in your Obsidian file, place in html img element src in your Simple RSS custom template, e.g.:
<img src=\"{{&$.url}}\" width=\"500\" height=\"auto\" style=\"some inline styles if you like" />

The Simple RSS plugin is not configured out of the box to call a description as a standard item field. Make a custom feed and add ‘description’ to the list of item fields you want to call.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.