pipes-digital / pipes

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

more control over 'replace' #138

Closed haayman-imagem closed 5 months ago

haayman-imagem commented 5 months ago

I've got this RSS feed https://www.destentor.nl/deventer/rss.xml where the title often changes, resulting in a different link every time except the last part after ~, e.g.

https://www.destentor.nl/regio-deventer/derde-klasse-en-lager-eenrichtingsverkeer-bij-helios-be-quick-zutphen-dicht-bij-periodetitel~aec0d31e

I'd like to be able to set the guid to just the part after ~, but the 'replace' function doesn't let me specify which field I'd like to replace (the link shouldn't be modified) and right now the guid is skipped entirely by the replace function

onli commented 5 months ago

The guid is currently using the changing title, right? In that case yes, this can work, we just need to add a field selector to the replace block and add the guid as a treated field.

But let's go into that problem for a bit. So the feed changes regularly, and they change the title, the guid and the link? And the problem is that because of that change you get the same feed items again and again as unread in your feedreader? Does the description change as well?

haayman-imagem commented 5 months ago

that's exactly it. I keep seeing the same post up to 3 or 4 times a day.

haayman-imagem commented 5 months ago

I use feed2toot to post new items to mastodon, so every change results in a new post on mastodon

onli commented 5 months ago

I was thinking about recommending to use the builderblock instead. That one can recalculate the guid, but it hashes the description plus the title for that :/ So the changing title would lead to an always changing guid, similar as to now. To make that configurable would be too much for the interface.

A guid-calculating block would not be completely off, but very specific to RSS. Too specific I think.

That's the same reason I'm hesitating a little bit: The replace block was targeting content inside a feed, and the guid is more some metadata that shouldn't really be exposed too much. It is usually irrelevant.

When you post the news item, do you use the description and the title in your toot?

haayman-imagem commented 5 months ago

I only use the title and the link

haayman-imagem commented 5 months ago

But isn't it a good option to add a dropdown to specify where the search/replace should be applied then?

onli commented 5 months ago

But isn't it a good option to add a dropdown to specify where the search/replace should be applied then?

Yes, I think it is :) But adding the guid to that selection would be new. And how should the block behave if all fields are selected? Should it really then replace text in the guid by default? That feels off.

Ideally those field selections in blocks should be extended to offer all possible fields in the input field. But not sure we can do this now in the current flow.

If we find no other solution, I will add a field selection to the replace block, with guid as an option, but not being treated when the default is selected.

I only use the title and the link

Does the description stay constant, or is that changed as well?

If the description stays constant, you might be able to use that instead. Then you could replace the title with something static - like the description -, give all of that to a feed builder block and use its "Recalculate guid" option. That should work.

haayman-imagem commented 5 months ago

I reckon that if they're constantly finetuning the title this is probably true for the description

haayman-imagem commented 5 months ago

yes, the default behaviour for the dropdown should be the same as what you're doing now of course. The (multiselect) dropdown is just meant to give more control

onli commented 5 months ago

@haayman-imagem I added a field dropdown to the replace block, with guid as an option. Give it a try please :) You might need to reload the editor to see the change.

haayman-imagem commented 5 months ago

It works like a charm. Clever how the attribute isPermalink changes to false. I was already worries about that

onli commented 5 months ago

That's based on some simple logic in https://github.com/pipes-digital/pipes/blob/95854a6a528595d04b079812b11644fb7124257f/block.rb#L53, I hope it holds up. Thanks for testing! Please close here when you are comfortable with the solution.