Use javascript to get a random image from Google images

后端 未结 2 727
遇见更好的自我
遇见更好的自我 2020-12-24 08:17

I have this idea for my website that every time you visit the page, the background will be different. I want to get literally any picture from Google images and place it as

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-24 08:32

    It can be done via Google Images though much customization is required so the script behaves as you intended (including setting up a delay to handle rate-limiting; Google has a rate-limit of 64 items per search request over API) here is a basic example using Google Images api:

    
    
        
        
        
    
    
    
    
    
    

    However may I suggest instead: Random images from flickr, here is another basic code for that (sky is the limit):

    
    
        
        
        
    
    
    
    
    
    

提交回复
热议问题