Search code examples
imageautomationemail-validation

Program that takes name from api and finds first google image and saves it under that name


I am working on a college website, I am adding email validation using api that has thousands of colleges names. I want to make the interface a bit more personalized using images of the college as the page cover. But as mentioned it has thousands of names. when searching the name of the college on google the first result usually yields high res and nice looking image, would there be anyway to implement this to have it be the cover for all the respective colleges? I am new to programming and this is one of my first more complicated projects. Be nice.


Solution

  • First of all, I recommend you to use this API to get Google images but you would also need another library (depends on the language/framework you are using) to extract the image from the API result (original field to be exact).

     "images_results": [
        {
          "position": 1,
          "thumbnail": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSMzLN9iUjPiaNdA8w7NtzSTuJI0UPbDFOQKh3IXF6buUYmkaNr",
          "original": "https://as-images.apple.com/is/image/AppleInc/aos/published/images/o/g/og/default/og-default?wid=1200&hei=630&fmt=jpeg&qlt=95&op_usm=0.5,0.5&.v=1525370171638",
          "source": "apple.com",
          "title": "Apple Accessories for Apple Watch, iPhone, iPad, iPod, and Mac - Apple",
          "link": "https://www.apple.com/shop/accessories/all-accessories"
        },