Skip to content

fix: YouTubeFeedExpanderBridge getIcon() null pointer and performance#5011

Open
thrawn-sh wants to merge 1 commit into
RSS-Bridge:masterfrom
thrawn-sh:master
Open

fix: YouTubeFeedExpanderBridge getIcon() null pointer and performance#5011
thrawn-sh wants to merge 1 commit into
RSS-Bridge:masterfrom
thrawn-sh:master

Conversation

@thrawn-sh

Copy link
Copy Markdown

getIcon() had two issues:

  1. Null pointer exception: The find() call for [itemprop="thumbnailUrl"] can return null when the element is not present on the page, causing a fatal error when accessing ->href on the result.

  2. Unnecessary HTML fetching: Every call to getIcon() fetched and parsed the full YouTube channel HTML page just to extract the icon URL. On instances with a higher number of YouTube feeds, this causes throttling or outright blocking by YouTube, since each feed triggers a full page load solely to resolve the channel icon.

Fix the null pointer by checking the find() result before accessing its property, falling back to the parent FeedExpander::getIcon() which returns the generic YouTube favicon.

Cache the resolved icon URL via loadCacheValue/saveCacheValue (24h TTL) so subsequent requests return the cached string directly without fetching the channel page, significantly reducing the number of requests made to YouTube.

Add dedicated test coverage for parseItem(), hideshorts filtering, embed/nocookie URL handling, and the getIcon() caching and fallback behavior.

getIcon() had two issues:

1. Null pointer exception: The find() call for [itemprop="thumbnailUrl"]
   can return null when the element is not present on the page, causing
   a fatal error when accessing ->href on the result.

2. Unnecessary HTML fetching: Every call to getIcon() fetched and parsed
   the full YouTube channel HTML page just to extract the icon URL.
   On instances with a higher number of YouTube feeds, this causes
   throttling or outright blocking by YouTube, since each feed
   triggers a full page load solely to resolve the channel icon.

Fix the null pointer by checking the find() result before accessing its
property, falling back to the parent FeedExpander::getIcon() which
returns the generic YouTube favicon.

Cache the resolved icon URL via loadCacheValue/saveCacheValue (24h TTL)
so subsequent requests return the cached string directly without
fetching the channel page, significantly reducing the number of
requests made to YouTube.

Add dedicated test coverage for parseItem(), hideshorts filtering,
embed/nocookie URL handling, and the getIcon() caching and fallback
behavior.
@github-actions

Copy link
Copy Markdown

Pull request artifacts

Bridge Context Status
YouTubeFeedExpander 1 untitled (current) HTTP status 500 Internal Server Error
Type: ErrorException
Message: Attempt to read property "href" on null
YouTubeFeedExpander 1 untitled (pr) Bridge returned error 404! (20628)
Type: HttpException
Message: https://www.youtube.com/feeds/videos.xml?channel_id=UCzORJV8l3FWY4cFO8ot-F2w resulted in 404 Not Found

last change: Wednesday 2026-06-24 06:29:28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant