RSS-Bridge / rss-bridge

The RSS feed for websites missing it
https://rss-bridge.org/bridge01/
The Unlicense
7.39k stars 1.04k forks source link

[HackerNews] Fix tag containing comment #4226

Open rakoo opened 3 months ago

rakoo commented 3 months ago

Caution: this is untested because I have trouble running the docker command, but it's minor

github-actions[bot] commented 3 months ago

Pull request artifacts

Bridge Context Status
HackerNewsUserThreads 1 untitled (current) Bridge returned error 0! (19956)
Type: ErrorException
Message: Attempt to read property "innertext" on null
HackerNewsUserThreads 1 untitled (pr) Bridge returned error 0! (19956)
Type: ErrorException
Message: Attempt to read property "innertext" on null

last change: Wednesday 2024-08-21 18:16:34

dvikan commented 3 months ago

it already broken from before.

your suggestion suffers the same fate:

Details
Type: ErrorException
Code: 0
Message: Attempt to read property "innertext" on null
File: bridges/HackerNewsUserThreadsBridge.php
Line: 43
rakoo commented 2 months ago

So, I don't know how to fix this; it now "works on my machine" (but I know how bad this sentence is)

Any help on what I can do to have a look at that ?

Bockiii commented 1 month ago

I dug into this a bit and it looks like the .innertext in line 43 is correct in general.

Is it possible that the innertext might be empty for some comments? If the comment is an image for example? I'm not sure of the capabilities of the thread board.

Can you add an error handling if the innertext of the comment is empty, then just set it to "" or something?

if (empty($element->find('span[class*="commtext"]', 0)->innertext))

rakoo commented 1 month ago

No, HackerNews is a text-only message board. Moreove the error seemed to be related to the containing div being null. I put a null-check on it.

The build is broken because of #4310, fixed in #4311