背景
在谷歌浏览器上有一个非常好看的桌面,叫做momentum,每天会更新图片,太美了
代码
import time
import requests
client_id = 'aff58215-a36f-4894-9208-e1fa3d4b8d0a' # 替换成自己的
today = time.strftime("%Y-%m-%d")
url = 'https://api.momentumdash.com/feed/bulk?syncTypes=backgrounds&localDate={localDate}'
headers = {
'authorization':'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2MDY2Mzc0OTIuMCwibmJmIjoxNTc1MDE0NzkyLjAsImlzcyI6ImxvZ2luLWFwaS12MiIsInVzZXJfZ3VpZCI6IjVjNjE5N2MxLThkYmYtNGY4MS1iODI3LTIxZTg0ZTA4YzcyZSJ9.hyAjKOjjZW1dfyKXdXkHK1lLDC4Y7xEJvpetnEpCp-M',
'Host': 'api.momentumdash.com',
'Accept': '*/*',
'X-Momentum-ClientId': client_id,
'x-momentum-clientdate': time.strftime("%Y-%m-%dT%H:%M:%S"),
'X-Momentum-Version': '0.100.1',
'x-momentum-settings-etag': '0400bf20-0000-0000-0000-5aaf255a0000',
'X-Momentum-ClientDate': today,
'X-Requested-With': 'XMLHttpRequest',
'User-Agent':'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2987.133 Safari/537.36',
'Content-Type': 'application/json',
'cookie': ''
}
if __name__ == '__main__':
response = requests.get(url.format(localDate=today), headers=headers).json()
print(response)
backgrounds = response['backgrounds']
today_uri = backgrounds[0]['filename']
tomorrow_uri = backgrounds[1]['filename']
print('today_uri={today_uri}'.format(today_uri=today_uri))
print('tomorrow_uri={tomorrow_uri}'.format(tomorrow_uri=tomorrow_uri))
windows 本地
C:\Users\ [用户名]\AppData\Local\Google\Chrome\User Data\Default\Extensions\laookkfknpbbblfpciffpaejjkokdgca\ [版本号] \backgrounds