FreshRSS / FreshRSS/FreshRSS

[Bug] Image src not loading from srcset with responsive-img and src stripped by data-sanitized-class due to transparent gif image placeholder

Open
#8,699 0 comments 0 reactions 0 assignees View on GitHub
Bug (unconfirmed)
Dominant language
PHP
Stars
16k
Forks
1.3k
Avg merge
13h 24m
Merged PRs (30d)
40

Description

### Describe the bug

## Issue

I'm having issues retrieving **images** from articles using a placeholder base64 for "hidden image" (see image/gif in `src`), and the actual image(s) is within a `srcset` (with different sizes/qualities available).

The image is part of `responsive-img` class. I don't know if this is the "default way" of working with `reponsive-img` class(es)?

Within FreshRSS web viewer, if I look in the browser "elements" after fetching an article (see example below), it seems to get "caught" by the `data-sanitized-class` somehow:

```html

Tips-bilde av lysfenomen

```

## Example

Example from an article [[source](https://www.nrk.no/mr/lysfenomen-pa-himmelen-observert-fleire-stadar-i-landet-1.17850489)](https://www.nrk.no/mr/lysfenomen-pa-himmelen-observert-fleire-stadar-i-landet-1.17850489) (Norwegian Broadcasting Corporation). Note that this is just as an example, but most images from nrk.no is using `srcset` for the `reponsive-img` and the "hidden gif image" as `src`.

```html

Tips-bilde av lysfenomen


LYS: Dette bilde blei tatt i Kristiansund natt til fredag.


Foto: Tipsar

```

Feed source: https://www.nrk.no/toppsaker.rss

## What I want

Ideally, I'd like to extract the larget image from the srcset (best image quality) and use that as image src somehow. I guess people (possibly) could have different preferences here. From the `srcset` above, that would be image https://gfx.nrk.no/qjzJQnvlMt-VoCXf0miWowYK12pxH4h9veKgLdT4dyLQ.jpg (which is 2000w, and usually the largest quality from nrk.no).

## Related

I also use Obsidian and Obsidian Web Clipper (Chrome Extension) to download some articles in Markdown-format. I've written a custom filter using regex (for Obsidian Clipper template), which I'm using on (site) nrk.no, which basically extracts the "last image url" from the `srcset`, and uses that as `src` value:

```text
replace:"/srcset=.* ([^ ]+) \d+w .* /g":"src="
```

For reference, my full "selectorHtml" (in Obsidian Template-style)

```text
{{selectorHtml:#innhold|remove_html:(".lp_related")|replace:"/srcset=.* ([^ ]+) \d+w .* /g":"src="|remove_html:(".authors,.article-dateline,.link__container")|markdown}}
```

I know the above is not directly translated into usable code, but hopefully gives an idea of what I'd like to achieve.

I also noticed RSS-Bridge has a `parseSrcsetLargestImageUrl` function (https://github.com/RSS-Bridge/rss-bridge/blob/952857e4b62b632ac2d8a682b271706813448d4e/lib/html.php#L274); maybe we could have something similar, to basically extract the "largest image", and use that as "img src"?

**I'm no developer**, so please correct me if I misunderstood something here, or if there is a better way of retrieving the images from the srcset. I'm unsure on "how" this is best solved, e.g. within data-sanitized, or by e.g. using a custom JS for this specific feed (if possible)? I did a quick grep for `srcset` in the FreshRSS codebase, but did not find anything, other than something from a changelog back in 2016, which does not seem to exist anymore.

Some related issues I've found.
https://github.com/FreshRSS/FreshRSS/discussions/6563
https://github.com/FreshRSS/FreshRSS/issues/1077
https://github.com/FreshRSS/FreshRSS/issues/3823
https://github.com/FreshRSS/FreshRSS/issues/5016
https://github.com/FreshRSS/FreshRSS/issues/6875
https://github.com/FreshRSS/FreshRSS/issues/8317
https://github.com/FreshRSS/FreshRSS/pull/1086
https://github.com/FreshRSS/FreshRSS/pull/5154

### To Reproduce

1. Add RSS feed https://www.nrk.no/toppsaker.rss
2. Load any article
3. All `responsive-img` is caught by `data-sanitized-class`, hence no article images (within body) is loading

### Expected behavior

Images to load successfully, by using the srcset

### FreshRSS version

1.28.1

### System information

FreshRSS version
1.28.1
PHP version
8.4.16
cURL version
8.14.1
OpenSSL/3.5.4
Database
sqlite
3.46.1
Server software
Apache/2.4.66 (Debian)
Linux 6.12.55 #1-NixOS SMP PREEMPT_DYNAMIC Thu Oct 23 14:20:48 UTC 2025 x86_64
Browser
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36

### Additional context

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.