0

Let's say , I searched Dog Images on Google. I will get certain results. I just want to scrap the first image of dog.

I want to do this with python code, such that , in function I will just provide "Dog" and it should provide me the link of first image?

1 Answers1

0

It really depends.

def grab_links():
   # if you have results stored in a list
   results = [] #list of links
   return results[0] # return 1st element
Bhaskar N
  • 1
  • 1
  • But, how to fetch the result from google search results? – Manas Telavane Jul 14 '22 at 15:07
  • There are multiple options available * https://pypi.org/project/google_images_download/ * https://pypi.org/project/icrawler/ you could also implement the same with HTTP clients like requests, urllib3 or httpx – Bhaskar N Jul 14 '22 at 15:16
  • This might help for implementation https://stackoverflow.com/questions/35809554/how-to-download-google-image-search-results-in-python – Bhaskar N Jul 14 '22 at 15:28
  • Thanks Bhaskar N Your icrawler suggestion is working But, the images are downloaded in my folder. I want list of urls of image. Can you plz tell me how I can do this? – Manas Telavane Jul 14 '22 at 17:19
  • Well, Looks like icrawler doesn't have an API for that. Reference custom implementation can be found here https://github.com/hellock/icrawler/issues/73 – Bhaskar N Jul 15 '22 at 09:04