
Ask HN: API to get a website's images? - nkkollaw
I&#x27;m trying to develop a script that needs to fetch a website&#x27;s images (ideally, being able to sort by dimensions).<p>My first choice was to use Google Images, but I just found out that Google doesn&#x27;t offer an API anymore.<p>Same thing for Yahoo—they discontinued their service in March 2016.<p>And, Bing too doesn&#x27;t offer an API anymore.<p>I don&#x27;t know what made all major search engines discontinue access to their results via an API, but is there an alternative? It looks like there&#x27;s nothing out there for this task out there.<p>Scraping the website on the fly doesn&#x27;t seem to be feasible.<p>Thanks!!
======
nkkollaw
...EDIT: if anyone is interested, there is no API anymore. I tried Google's
Custom Search, but wasn't great at all.

I ended up using this Node package: [https://www.npmjs.com/package/images-
scraper/](https://www.npmjs.com/package/images-scraper/)

I don't know if it violates Google's TOS (it probably does), but it works
great.

------
dozzie
Here is an API for Python to download all the images from a website:

    
    
      imgget.get_all(url, run_javascript = False)
    

Though you have to implement a service behind it yourself.

~~~
nkkollaw
Thanks for replying, but I don't think that would work (correct me if I'm
wrong).

I tried building a scraper that downloads a webpage's HTML, follows all links,
and keeps going until it finds at least 3 high-resolution images (using cURL
to get their size), but of course it's not feasible.

I can't spider a whole site looking for images, nor download all of them.

Unfortunately I need to find some service that has already indexed the
website.

