-1

I am currently learning jquery and in one of my activities I have to get the src from some images on this webpage. But I can't seem to get the img URL. I managed selecting the image and to get any attribute but not src's url. This is the selector i am using:

$('img.thumbnail-img').attr("src");

But it gives me this back instead of the url:

data:image/gif;base64,R0lGODlhAwAEAIAAAAAAAAAAACH5BAEAAAAALAAAAAADAAQAAAIDhI9WADs=

EDIT: Hi! I think i didnt't quite explain myself. I want to get the image src url, and instead i get what i pasted above. By looking at the html of the page you can see that there is an actual image url like this one for example, but instead i get that data:image... thing which, by following the steps in the solution, is not the image i want to get. Maybe the selector is wrong?

Thanks!

Rever92
  • 19
  • 6
  • That is a URL ~ https://en.wikipedia.org/wiki/Data_URI_scheme – Phil Apr 12 '18 at 06:53
  • Possible duplicate of [Why use data URI scheme?](https://stackoverflow.com/questions/6819314/why-use-data-uri-scheme) – Phil Apr 12 '18 at 06:56

2 Answers2

1

The image used there is not on a file, it's an encoded base64 image. Therefore you get the image instead of URL.

You try this:

  1. Open https://www.base64decode.org/

  2. Paste R0lGODlhAwAEAIAAAAAAAAAAACH5BAEAAAAALAAAAAADAAQAAAIDhI9WADs= inside the textbox

  3. Click DECODE

  4. It should download the encoded image as a GIF file to your computer.

Taha Paksu
  • 15,371
  • 2
  • 44
  • 78
-1

I'll answer myself here, just solved it.

The problem was that, for some reason, in this webpage the attribute for the real image url was "data-src" so, i changed that in the selector and everything worked.

Thanks everyone for the help!

Rever92
  • 19
  • 6