dan-bowman / apod-wallpaper

set NASA's astronomy picture of the day as your desktop background
MIT License
0 stars 0 forks source link

Add handling for if the Astronomy Picture of the Day is not... a picture #1

Open dan-bowman opened 4 years ago

dan-bowman commented 4 years ago

More an unexpected result than an error/bug. Sometimes the api will send a different format of json entirely, without any "hdurl" attribute, so the image url passed into the wallpaper command is just a blank string. I did find a "media-type" attribute, and today's was a "video" type. Could check for that attribute to see if it is "video" or "image". Will have to wait till tomorrow to see if the APOD is indeed an image and if it has A: the "media-type" attribute and B: even the "hdurl" attribute. Since the json string has a slightly different structure, I can't rule out that some images won't contain an "hdurl" attribute, and would just have to use the "url" attribute.

dan-bowman commented 4 years ago

Might be cool to pull an image from NASA's image API at: https://images-api.nasa.gov as a secondary backup to the APOD