mirror of
https://github.com/fergalmoran/ferglie.git
synced 2025-12-22 01:07:55 +00:00
13 lines
363 B
Python
Executable File
13 lines
363 B
Python
Executable File
from urllib.request import urlopen
|
|
from xml.etree.ElementTree import parse
|
|
|
|
BASE_URL = 'http://www.bing.com/'
|
|
IOTD_URL = BASE_URL + 'HPImageArchive.aspx?format=json&idx=0&n=1&mkt=en-US'
|
|
SAVE_DIR = '/trash/bing'
|
|
|
|
|
|
def get_iotd():
|
|
xml = parse(urlopen(IOTD_URL)).getroot()
|
|
u = xml.findall('./image/url')[0]
|
|
return "%s%s" % (BASE_URL, u.text)
|