feedparser icon indicating copy to clipboard operation
feedparser copied to clipboard

How to get favicon

Open rohitkhatri opened this issue 7 years ago • 4 comments

Is there any way to get the favicon of the rss feed url?

rohitkhatri avatar Dec 05 '16 12:12 rohitkhatri

RSS feeds don't really have favicons per se, which is something of a shortcoming. As noted in the JSON Feed rationale:

Also, to further reduce bandwidth use, publishers should provide the top-level icon and favicon URLs. When not present, feed readers will often attempt to find these things by 1) downloading the home page and scraping the HTML, and 2) making one or more requests to likely locations for these images. To reduce traffic on your server, put this info in the feed.

The open PR #109 adds support for JSON Feeds, including icon, but otherwise there is not favicon support in feedparser.

twm avatar Jan 14 '18 02:01 twm

Atom also has an icon entry: https://pythonhosted.org/feedparser/reference-feed-icon.html

twm avatar Jan 14 '18 20:01 twm

The situation is unclear for me, too. First of all, I would need to know rss and atom feed offering icons as an example, to do some tests. Does anyone know such feed?

Feedparser itself offers FeedParserDict.feed.icon.

Also Atom and RSS sepcification support icons. https://snook.ca/archives/rss/add_logo_to_feed

In my understanding Feedparser still support icons if the feed offers it. Doesn't it?

buhtz avatar Apr 26 '19 06:04 buhtz

I can say I implemented getting favicons in my own Feedreader. It works but is complexe. Because there are many cases, different fields, urls or ways to handle this.

This is much to complex for feedparser. Feedparser should ofer favicon information if they are present in the xml file. not more. No handling of special cases.

In my understanding feedparse still does this very well. So the Issue can be closed.

@rohitkhatri If you need detailed infos about my implementation please contact me at https://codeberg.org/buhtz/Feedybus and I can give you access to the code and we can discuss details.

buhtz avatar Dec 17 '19 12:12 buhtz

@rohitkhatri You are free to look at NewsBlur's implementation of favicon fetching, using some guesses for the url if the link isn't found in the feed:

https://github.com/samuelclay/NewsBlur/blob/master/apps/rss_feeds/icon_importer.py

samuelclay avatar Apr 17 '23 13:04 samuelclay