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