-
Notifications
You must be signed in to change notification settings - Fork 109
/
wallpaper_changer_windows.py
54 lines (43 loc) · 1.26 KB
/
wallpaper_changer_windows.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python3
from win10toast import ToastNotifier
import requests
import datetime
import os
from bs4 import BeautifulSoup
from time import sleep
import ctypes
dt = datetime.datetime.now()
cd = str(dt.year)+'0'+str(dt.month)+str(dt.day)
url = "https://bingwallpaper.com/"
sc = requests.get(url)
soup = BeautifulSoup(sc.text,'lxml')
os.makedirs('Bing',exist_ok=True)
ul = soup.find('ul',{'class':'filmstrip'})
li = ul.findAll('li')
imageUrl =li[0].find('img').get('src')
res = requests.get(imageUrl)
with open(os.path.join('Bing',cd+'.jpg'),'wb') as file:
file.write(res.content)
path = r'C:\Users\sal13\Desktop\Bing\\'+cd+'.jpg'
ctypes.windll.user32.SystemParametersInfoW(20, 0, path, 3)
'''
i = 1
for data in soup.findAll('item'):
print (str(i)+'. '+data.find('description').text)
i += 1
list_links = []
for link in soup.findAll('item'):
list_links.append(link.find('guid').text)
toaster = ToastNotifier()
user_input = 1
while True:
url = list_links[user_input - 1]
sc = requests.get(url)
soup = BeautifulSoup(sc.text,'lxml')
score = soup.findAll('title')
toaster.show_toast("India Vs Afghanistan",
score[0].text,
icon_path=None,
duration=10)
sleep (150)
'''