#!/usr/bin/env python
# Get the background image from
# Bing and make it the wallpaper

import urllib

def main():
  page = urllib.urlopen("http://www.bing.com").read()
  start = page.find("/fd\/hpk2\/", 0)
  end = page.find("jpg", start)
  url = "http://www.bing.com" + page[start:end+3]
  urllib.urlretrieve(url, "bing.jpg")

if __name__ == '__main__': main()
