5 ms·
Ask HN: API to get a website's images?
I'm trying to develop a script that needs to fetch a website's images (ideally, being able to sort by dimensions).
My first choice was to use Google Images, but I just found out that Google doesn't offer an API anymore.
Same thing for Yahoo—they discontinued their service in March 2016.
And, Bing too doesn't offer an API anymore.
I don'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's nothing out there for this task out there.
Scraping the website on the fly doesn't seem to be feasible.
Thanks!!
- dozzie 10y agoHere 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 10y agoThanks 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.
- nkkollaw 10y ago...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.