I'm trying to create a script that will auto-downloads the Bing wallpaper of the day so it can be my desktop background, and so far I found out that the url for it is hidden in the g_img
tag. So what I've done so far is find the position of g_img={url: "
and then for the next "
.
from os.path import expanduser
import urllib
import os
HOME = expanduser("~")
os.system("wget https://www.bing.com")
str="g_img={url: \""
file="index.html"
pos=open(file, 'r').read().find(str)
pos2=open(file, 'r').read().find("\"", pos)
# function to get the url string
# function to get PicName
BingBackUrl= "https://www.bing.com%s" % url
urllib.urlretrieve(BingBackUrl, PicName)
os.system("gsettings set org.gnome.desktop.background picture-uri file://%s/%s" % (HOME, PicName))