Bing壁纸
其他 官方文档
获取不同国家Bing 壁纸
基本说明:
接口地址:https://raw.onmicrosoft.cn/Bing-Wallpaper-Action/main/data/zh-CN_all.json
返回格式:json
请求方式:get
请求示例:https://raw.onmicrosoft.cn/Bing-Wallpaper-Action/main/data/{lang}.json
请求参数说明:
名称 类型 必填 说明
lang string 必填 zh-CN_all中文,en-US_all英文,ja-JP_all日语
返回参数说明:
名称 类型 说明
url string 图片链接
title string 图片标题
JSON返回示例:
{
	"LastUpdate": "2023-07-11 00:50:01",
	"Total": 440,
	"Language": "zh-CN",
	"message": "ok",
	"status": true,
	"success": true,
	"info": "https://raw.onmicrosoft.cn/Bing-Wallpaper-Action/main/data/info.json",
	"data": [{
		"startdate": "20230710",
		"fullstartdate": "202307101600",
		"enddate": "20230711",
		"url": "/th?id=OHR.WorldPopDay_ZH-CN7074706912_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp",
		"urlbase": "/th?id=OHR.WorldPopDay_ZH-CN7074706912",
		"copyright": "Hong Kong SAR (© leungchopan/Getty Images)",
		"copyrightlink": "https://www.bing.com/search?q=%E9%A6%99%E6%B8%AF%E7%89%B9%E5%88%AB%E8%A1%8C%E6%94%BF%E5%8C%BA&form=hpcapt&mkt=zh-cn",
		"title": "万家灯火",
		"quiz": "/search?q=Bing+homepage+quiz&filters=WQOskey:%22HPQuiz_20230710_WorldPopDay%22&FORM=HPQUIZ",
		"wp": true,
		"hsh": "7d5962d2f7d167bd88d3b2291734b799",
		"drk": 1,
		"top": 1,
		"bot": 1,
		"hs": []
	}]
}
服务级错误码参照
错误码 说明
- -
完整教学代码示例
<?php
/**
 * Created by PhpStorm.
 * User: FZS
 * Time: 2023/06/05 14:26
 */
class freeApi
{
    private $apiUrl;

    public function __construct()
    {
        $this->apiUrl = 'https://raw.onmicrosoft.cn/Bing-Wallpaper-Action/main/data/zh-CN_all.json';
    }

    /**
     * 获取结果
     * @return array
     */
    public function getResult()
    {
        return file_get_contents($this->apiUrl);
    }
}
package main

import (
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
)

const (
	APIURL   = "https://raw.onmicrosoft.cn/Bing-Wallpaper-Action/main/data/zh-CN_all.json"
)

func main() {
	queryUrl := fmt.Sprintf("%s",APIURL)
	resp, err := http.Get(queryUrl)
	if err != nil {
		log.Println(err)
		return
	}

	defer resp.Body.Close()

	body, err := ioutil.ReadAll(resp.Body)

	if err != nil {
		fmt.Println(err)
		return
	}

	fmt.Println(string(body))
}