feedparser
feedparser copied to clipboard
How to get favicon
Is there any way to get the favicon of the rss feed url?
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
andfavicon
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.
Atom also has an icon entry: https://pythonhosted.org/feedparser/reference-feed-icon.html
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?
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.
@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