Guest User

Bing Wallpaper Downloader

a guest
Aug 31st, 2015
1,784
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Documentation Source - https://stackoverflow.com/questions/10639914/is-there-a-way-to-get-bings-photo-of-the-day
  2.  
  3. $Temp = "C:\temp"
  4.  
  5. #Select what resolution you would like
  6. $Resolution = '1920x1080' #Supported up to 1920x1200, though it has a water mark anything below does not
  7.  
  8. #Access the JSON API
  9. $JSON = (((Invoke-WebRequest -Uri 'http://www.bing.com/HPImageArchive.aspx?format=js&idx=1&n=1&mkt=en-US').content) | ConvertFrom-Json).images
  10.  
  11. #Build URL to download the file(s)
  12. $ImageURL = ("http://bing.com" + $json.url)
  13.  
  14. #Create Temp if it does not exist
  15. if (!(Test-Path $Temp -ErrorAction SilentlyContinue)) {New-Item -Path $Temp -ItemType Directory}
  16.  
  17. #Download the Image
  18. Invoke-WebRequest -Uri $ImageURL -UseBasicParsing -OutFile ($Temp + '\' +$json.urlbase.Split("/")[-1] + ".jpg")
Add Comment
Please, Sign In to add comment