def set_nasa_wallpaper():
st = datetime.fromtimestamp(time.time()).strftime('%y%m%d')
url = URL07.format(st)
r = requests.get(url)
if r.status_code == 200:
try:
parser = etree.HTMLParser(recover=True)
html = etree.HTML(r.content, parser)
images = html.iter('img')
if images is not None:
images = list(images)
if len(images) > 0:
image_url = images[0].getparent().attrib['href']
image_url = 'https://apod.nasa.gov/' + image_url
if download(image_url) is True:
set_background(comun.POTD)
except Exception as e:
print(e)
ngdownloader.py 文件源码
python
阅读 28
收藏 0
点赞 0
评论 0
评论列表
文章目录