pipes-digital / pipes

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

Custom favicons #133

Closed mbologna closed 4 months ago

mbologna commented 6 months ago

My feed reader show the favicon of pipes.digital, is there a way to build a feed and to specify a custom favicon?

onli commented 6 months ago

Hi @mbologna ! Sadly I do not have a solution for this.

The feedreader will likely just fetch the favicon from the origin of the feed, which in this case will always be pipes.digital itself. If your feedreader instead would use an element from the feed itself, then we could manipulate the feed - but the image element is to my knowledge always ignored. Probably because those don't have to be a square.

Depending on the reader you use there might be an option to change the used icon. But in my reader at least, Fresh RSS, I saw no such option.

mbologna commented 6 months ago

I think that the solution would be to manipulate the feed produced by pipes.digital and declare the favicon in the feed like this:

<link rel="shortcut icon" href="website_source/favicon.ico" type="image/x-icon" />
onli commented 6 months ago

Oh, that'd be interesting. Could you point me to a feed that uses this solution?

mbologna commented 6 months ago

Oh, that'd be interesting. Could you point me to a feed that uses this solution?

I have done an experiment but it does not work, as the browser will look in /favicon.ico nevertheless. All in all I think, that this limitation cannot be overcame, unfortunately.

onli commented 6 months ago

Ha, good idea to just put up a modified textfile. Sad that it did not work.

Should we close here, and re-open if we stumble over a solution?

mbologna commented 5 months ago

I just found out that another application (RSS Filter) manipulates a feed while keeps the original favicon/logo. Example: if you add https://rssfilter-a7aj2utffa-uc.a.run.app/feed?title_allow=Google&url=https%3A%2F%2Fwww.arstechnica.com%2Ffeed%2F to your feed reader, it shows the original site logo.

I believe that the feed built by pipes.digital is missing the <image>:

<channel>
        <image>
            <url>
                https://cdn.arstechnica.net/wp-content/uploads/2016/10/cropped-ars-logo-512_480-32x32.png</url>
            <title>Ars Technica</title>
            <link>https://arstechnica.com</link>
            <width>32</width>
            <height>32</height>
        </image>

(in case of combined feed, just replicate the first feed's <image>. What do you think?

onli commented 5 months ago

A little bit confusing, because that seems to be exactly the image element I claimed would be ignored. But I can confirm that the feed you linked to does have an image element, I mean, icon in my feed reader. You could now extract that element and insert it into a feed by pipes ;)

I will check whether pipes' RSS feed generation code can keep the image element of the channel.

onli commented 5 months ago

Let's start maybe indeed with a solution to do this with Pipes? Have a look:

Screenshot 2024-01-23 at 15-33-05 Editor Pipes

As a last step of your pipe, take the original feed and extract the image element (path: /rss/channel/image, attribute: OuterXml) and insert this into your feed with the insert block (at /rss/channel).

Because on a first look, it seems like the feed parser library Pipes use drops the image element completely, so this would be linked to the bigger question of how to not parse the data like this when going from block to block, or at least would need a parser extension.

mbologna commented 5 months ago

As a last step of your pipe, take the original feed and extract the image element (path: /rss/channel/image, attribute: OuterXml) and insert this into your feed with the insert block (at /rss/channel).

I added the workaround for the <image> tag: image but it returns a HTTP 500: https://www.pipes.digital/feedpreview/pqwY2wNB

Because on a first look, it seems like the feed parser library Pipes use drops the image element completely, so this would be linked to the bigger question of how to not parse the data like this when going from block to block, or at least would need a parser extension.

What parser library is Pipes using?

onli commented 5 months ago

Hm, I went into the logs and don't understand the error. It's the insert block that claims it sees no element?

Try it from here: https://www.pipes.digital/pipe/POdv0L9D. That pipe works for me, it should be possible to extend it feed by feed. Maybe we can pinpoint like this where the error is.

What parser library is Pipes using?

Pipes is running the feeds through https://github.com/rubycocos/feedparser/tree/master/feedparser for normalization

mbologna commented 5 months ago

Hm, I went into the logs and don't understand the error. It's the insert block that claims it sees no element?

I don't see any error from the UI either.

Try it from here: pipes.digital/pipe/POdv0L9D. That pipe works for me, it should be possible to extend it feed by feed. Maybe we can pinpoint like this where the error is.

I added the feed in Feedly but the feed icon is not shown. Maybe because the <image> tag is towards the end?

onli commented 5 months ago

I added the feed in Feedly but the feed icon is not shown. Maybe because the tag is towards the end?

That shouldn't matter, I would expect the feed reader to parse the whole file and the position doesn't matter in XML. But you are right! It doesn't work also in FreshRSS. And right: The position does not matter, I uploaded the rss file and changed it to the top, no change.

Did we miss something else?

mbologna commented 5 months ago

Seems like Ars' feed is XML not valid right now. Can you please retry with something else, like https://openrss.org/www.theverge.com ?

onli commented 5 months ago

It's the link element!

The feed has this in it:

?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="/www.theverge.com/.xsl"?>
<rss version="2.0">
  <channel>
    ...
    <link><![CDATA[https://arstechnica.com/]]></link>

The image element is ignored, but depending on the link element the favicon of the linked site gets selected. At least in FreshRSS. It's a bit hard to test because changing the element in an already subscribed file did not change the favicon for me, but creating a new feed with changed links works as expected. I set in https://pipes.digital and it switched.

Can you confirm that?

Changing the link element of the channel should be something we can also do with an insert block :)

mbologna commented 5 months ago

Can you confirm that?

I tried with the feed you linked above (https://www.pipes.digital/feed/POdv0L9D?) but it still show the pipes.digital icon

onli commented 5 months ago

Did you try it directly with that feed, or did you modify the output to change the link element? The needed modification is not done there yet

mbologna commented 5 months ago

I did the following:

image

and I can see the <link> correctly populate in the feed https://www.pipes.digital/feed/pqwY2wNB? I re-added the feed to Feedly but I still see pipes.digital's favicon

onli commented 5 months ago

It's not quite correct I think, because this will set a second link element. Instead replace the content of the old one:

Screenshot 2024-01-25 at 14-39-51 Editor Pipes

I changed it in https://www.pipes.digital/pipe/POdv0L9D and it worked for me! :)

mbologna commented 5 months ago

I changed it in pipes.digital/pipe/POdv0L9D and it worked for me! :)

I tried this one in Feedly and I still see pipes.digital's favicon. I guess Feedly uses a different criteria?

onli commented 5 months ago

Hm. They might use the atom10:link element instead. Or the old icon is cached for that feed. Maybe try it once more in a different pipe?

mbologna commented 5 months ago

Screenshot 2024-01-25 at 14-39-51 Editor Pipes

I duplicated the feed above and I can confirm it is working, so likely a caching issue on Feedly. Thanks a lot for the shared debugging and the solution, it was fun!

onli commented 5 months ago

Fun indeed :) And we solved it!

The logic to set the pipes site by default is not bad by itself, so I think we can stick to the custom solution we identified here?

mbologna commented 5 months ago

Yes this is a workaround, at least, until the dependency library can be instructed to fetch the <link>.