Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unwrapNoscriptImages missing some images #15

Open
olivier-m opened this issue May 28, 2020 · 0 comments
Open

unwrapNoscriptImages missing some images #15

olivier-m opened this issue May 28, 2020 · 0 comments

Comments

@olivier-m
Copy link

Hi !

the unwrapNoscriptImages() method of the parser uses the image in the noscript tag when there is an image just before it, which works well in that very case. But there is no fallback for when there's no such previous image.
I made my own pre parsing function to fix this behaviours and it seems to work quite well. The idea is to replace the noscript tag in the "else" case of "if prevElement != nil && ps.isSingleImage(prevElement)". Something like that:

} else {
  dom.ReplaceChild(noscript.Parent, dom.FirstElementChild(tmpBody), noscript)
}

You can test the difference on https://www.newyorker.com/magazine/2020/06/01/a-window-onto-an-american-nightmare where the cartoons are not visible.
Sorry for not submitting a PR, I can make one if that something you'd prefer.

jedevc added a commit to jedevc/go-readability that referenced this issue May 10, 2022
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

No branches or pull requests

1 participant