懒人直接出图
https://www.shadow-forum.com/api/bing/bing.php

API
相关参数
resolution 壁纸的分辨率. 1920 为默认值, 你也可以将其设置为 1366.
format API的调用返回格式, 值可以为 json 或者 image. 如果返回格式设置为 image, API会直接跳转请求到对应的图片地址.
index 壁纸的index,默认从0开始。由于Bing壁纸的图片每日更新,所以通过index值可以获取之前的图片。
mkt Bing壁纸的地区参数,默认为 zh-CN, 你也可以将其设置为 en-US, ja-JP, en-AU, en-UK, de-DE, en-NZ, en-CA。
调用示例
1
|
https://bing.biturl.top/?resolution=1920&format=json&index=0&mkt=zh-CN
|
1 2 3 4 5 6 7
|
{ "start_date": "20181118", "end_date": "20181119", "url": "https://www.bing.com/az/hprichbg/rb/NarrowsZion_ZH-CN9686302838_1920x1080.jpg", "copyright": "锡安国家公园内的维尔京河,美国犹他州 (© Justinreznick/Getty Images)", "copyright_link": "http://www.bing.com/search?q=%E9%94%A1%E5%AE%89%E5%9B%BD%E5%AE%B6%E5%85%AC%E5%9B%AD\\u0026form=hpcapt\\u0026mkt=zh-cn" }
|
CSS中设置背景图片
可以使用此API直接在CSS中设置背景图片:
1 2 3
|
background-image: url(https://bing.biturl.top/?resolution=1920&format=image&index=0&mkt=zh-CN); background-size: 100%; background-repeat: no-repeat;
|