pipes-digital / pipes

Repository for Pipes
https://pipes.digital
GNU Affero General Public License v3.0
264 stars 21 forks source link

Inserting new values in specific attributes of feed elements #92

Open benfishbus opened 2 years ago

benfishbus commented 2 years ago

I'm trying to make a podcast feed, so I started from one with all the proper elements and am replacing various URLs and other content pulled from webpages. The enclosure element has three attributes: length, url, type. I'm trying to Insert a URL (the sole contents of content:encoded element) in place of the one currently in this url attribute, but it's not working - it just inserts at the root of enclosure element. Is it not possible to insert into a specific attribute of an element? I have tried a bunch of different selector syntax.

onli commented 2 years ago

I think you are right. I don't see this working currently with the insert block. I think the logical solution would be something like //enclosure/content:encoded/@url, but also in my tests this just had no effect.

Do you agree that this is the right syntax? Then I would try to extend the insert block for that. But I'm open for alternatives.

There should already be a workaround: Extract //enclosure/content:encoded, use the replace block to add the url and then insert that new block at the old position. But that's admittedly a bit cumbersome.

benfishbus commented 2 years ago

After some more testing, it turns out I can insert to URL attribute of enclosure element using xpath //enclosure/@url. That answers my specific question here, but leads to another problem: It inserts the same URL in all the feed items. I'm not sure if/how I would use ForEach to solve this.

onli commented 2 years ago

I'm surprised the URL attribute could be targeted. Could you link me to an example pipe please? If you don't want to share it publicly you could email me at support@pipes.digital.

It inserts the same URL in all the feed items. I'm not sure if/how I would use ForEach to solve this.

Right, the insert block currently only selects the very first element. I doubt that this is solvable with the current set of block. Maybe the foreach block could be extended to support this usecase. Or maybe the behaviour of the insert block has to change, it is strange that is only inserts one single element.

benfishbus commented 2 years ago

https://www.pipes.digital/pipe/d918Kbqx

Yes, if Insert block could be dropped into ForEach, would be good.

onli commented 2 years ago

By now I think the insert block needs to change its default behaviour and add each input input item, not only the first. The old behaviour should be toggleable, and set as default for existing pipes.

anewuser commented 2 years ago

The new Feedburner makes easy it to turn links into podcast enclosures and configure iTunes tags. It is still being rolled out, though. You should be able to use it within the next days or weeks:

New Feedburner