2

guys. When I do this with cheerio:

$(".img-class-name").attr("src");

I just get part of the string:

"data:image/gif;base64,R0lGODlhAQABAIAAAP///////yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="

The content is right but its was cut. Cheerio adds these slashes /////// to replace the rest of the real data. It should be a much longer string. Is there a limit for string size in Cheerio? Whats is happening here?

Phil
  • 21
  • 2
  • Compare against the `view-source:` version of the site to show that it's not being truncated by Cheerio. These are likely lazy-loaded, and you'll need a dynamic scraper to access the full images (or try to find out if they're elsewhere in the source code). Without the actual URL it's difficult to help. – ggorlen Sep 01 '23 at 18:06

1 Answers1

0

No that's a legit base64 image. It's probably a placeholder image that gets replaced with javascript.

pguardiario
  • 53,827
  • 19
  • 119
  • 159
  • No its not. If it was you would be able to see the picture when pasting the base64 text I posted in the browser address bar. But you cant, because cheerio is only giving me part of the base64 code When I inspect the html file that I get from request the full base64 code is there in the src attribute. I really need help with this. – Phil Jan 23 '20 at 09:56
  • 1
    You're wrong Phil. It's a 1 pixel height image. A placeholder image in other words. – pguardiario Jan 23 '20 at 10:00