snacktory
snacktory copied to clipboard
wrong imageUrl in youtube url's
This happens whenever you fetch an Youtube link like: https://www.youtube.com/watch?v=1a6KjDmHbR4
Instead of using the "og:image" from the head, it's setting the imageUrl as the first image in the
, so in the provided example url, it's getting "https://s.ytimg.com/yts/img/pixel-vfl3z5WfW.gif" instead of the og:image that is the correct one: "https://i.ytimg.com/vi/1a6KjDmHbR4/maxresdefault.jpg"Is there a work around this?
Not that I know. You would have to look in the sources and provide a pull request for this.
@karussell snacktory picks blindly the first <img of the page as the the page imageUrl.
A better approach would probably be to use the provided "og:image" instead.
Not sure I would be able to dig into the code to fix this, but I definitely miss the actual HTML result to be available on the "HtmlFetcher" class, so I could quickly hack a fix to get the og:image using Jsoup.