-
Code's Tags
-
Your Codes
-
Reffers
-
Linked Codes
|
Code:
Short link for Twitter:
HTML:
HTML view:
Copy Source | Copy HTML- #!/usr/bin/env python
- # -*- coding: UTF-8 -*-
-
- import os
- import re
- import urllib
- import random
-
- #***************************************CONFIG****************************************************************
- tmp_path = '/var/tmp/wallpaper/'
- #*************************************************************************************************************
-
- raw_data = urllib.urlopen("http://www.socwall.com/browse/index.php?wpCategory=Everything&wpSubcategory=All&wpLimit=90&wpSortby=0&wpFilter=1&wpQueryType=0&wpMarker="+str(random.randint(10,850))).read()
-
- list_url = re.findall('(http:\/\/.*?\/wpDL\.php\?wp_id=\d*)', raw_data)
- randitem = list_url[random.randint( 0, len(list_url))]
- raw_data = urllib.urlopen(randitem).read()
- url = re.search('(http:\/\/.*?\.jpg)', raw_data).group()
- if os.path.exists(tmp_path+'test.jpg'):
- os.remove(tmp_path+'test.jpg')
- os.system('wget '+url+' -O '+tmp_path+'test.jpg')
- os.system('gconftool-2 --set --type string /desktop/gnome/background/picture_filename '+tmp_path+'test.jpg')
-
|