必应每日图片、私有图床壁纸查询Api

必应每日图片、私有图床壁纸查询Api

2022年07月24日 阅读:162 字数:929 阅读时长:2 分钟

可查询必应每日、历史图片(每日定时任务更新);私有图床壁纸。

1、获取必应每日图片

查询cn.bing.com当天、历史图片,定时任务采集当天图片信息。

通过请求 https://cn.bing.com/HPImageArchive.aspx?idx=0&n=1&format=js&mkt=zh-CN 获取数据,其中idx为获取多少天前的数据,最大往前推8天,n为条数,最大也为8条。

历史数据来源于 https://bing.ioliu.cn/https://bing.xinac.net/ 网站,存于MongoDB。

地址:https://api.timelessq.com/bing

1.1、请求参数

参数名 位置 类型 必填 说明
date
query
string
示例值:2021-10-01
说明:查询指定日期图片
format
query
string
示例值:json
说明:响应格式,不传默认重定向图片地址

1.2、示例代码

var axios = require('axios');

var config = {
   method: 'get',
   url: 'https://api.timelessq.com/bing'
};

axios(config)
.then(function (response) {
   console.log(JSON.stringify(response.data));
})
.catch(function (error) {
   console.log(error);
});

1.3、响应示例

{
  "errno": 0,
  "errmsg": "",
  "data": {
    "_id": "62dabc01ad7f000049006757",
    "copyright": "绚烂的仙女座星系 (© NASA/JPL-Caltech)",  // 版权信息
    "time": "2021-10-04",   // 壁纸日期
    "title": "绚烂的仙女座星系 ",   // 标题
    "url": "https://cn.bing.com/th?id=OHR.Andromeda_ZH-CN1967953496_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp",   // 地址
    "urlbase": "/th?id=OHR.Andromeda_ZH-CN1967953496"
  }
}

2、获取必应随机图片

地址:https://api.timelessq.com/bing/random

2.1、请求参数

参数名 位置 类型 必填 说明
format
query
string
示例值:json
说明:响应格式,不传默认重定向图片地址

2.2、示例代码

var axios = require('axios');

var config = {
   method: 'get',
   url: 'https://api.timelessq.com/bing/random'
};

axios(config)
.then(function (response) {
   console.log(JSON.stringify(response.data));
})
.catch(function (error) {
   console.log(error);
});

2.3、响应示例

{
  "errno": 0,
  "errmsg": "",
  "data": {
    "_id": "62dabc01ad7f000049006543",
    "copyright": "Micheldever Wood的蓝铃花,英国汉普郡 (© Hursley/Getty Images Plus)", // 版权信息
    "time": "2020-04-20", // 日期
    "title": "Micheldever Wood的蓝铃花,英国汉普郡", // 标题
    "url": "https://cn.bing.com/th?id=OHR.BluebellWood_ZH-CN8128422960_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp", // 图片地址
    "urlbase": "/th?id=OHR.BluebellWood_ZH-CN8128422960"
  }
}

3、获取必应图片列表

地址:https://api.timelessq.com/bing/list

3.1、请求参数

参数名 位置 类型 必填 说明
page
query
string
 
pageSize
query
string

3.2、示例代码

var axios = require('axios');

var config = {
   method: 'get',
   url: 'https://api.timelessq.com/bing/list',
   params: {
      page: 1,
      pageSize: 10
   }
};

axios(config)
.then(function (response) {
   console.log(JSON.stringify(response.data));
})
.catch(function (error) {
   console.log(error);
});

3.3、响应示例

{
  "errno": 0,
  "errmsg": "",
  "data": {
    "count": 1389,
    "totalPages": 70,
    "pageSize": 20,
    "currentPage": 1,
    "data": [
      {
        "_id": "62df363c648d8b03d9c2ec88",
        "title": "被人类遗忘的森林", // 标题
        "copyright": "萨卢姆三角洲国家公园的红树林,塞内加尔共和国 (© mariusz_prusaczyk/Getty Images)", // 版权信息
        "url": "https://cn.bing.com/th?id=OHR.MangroveDay_ZH-CN5590436101_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp", // 图片地址
        "urlbase": "/th?id=OHR.MangroveDay_ZH-CN5590436101",
        "time": "2022-07-26" // 日期
      },
      {
        "_id": "62dde88704664d519625f9f6",
        "title": "守住关口",
        "copyright": "兰贝里斯山口脚下的多尔巴达恩城堡,威尔士 (© Viktoria Rodriguez/Getty Images)",
        "url": "https://cn.bing.com/th?id=OHR.DolbadarnCastle_ZH-CN5397592090_1920x1080.jpg&rf=LaDigue_1920x1080.jpg&pid=hp",
        "urlbase": "/th?id=OHR.DolbadarnCastle_ZH-CN5397592090",
        "time": "2022-07-25"
      }
    ]
  }
}

4、获取私有图床随机图片

原本打算使用新浪的,但是毕竟第三方可能会防盗链,索性使用Chevereto搭建的私有图床,网站地址:http://img.timelessq.com/ ,经费有限带宽小,流量不够可能就停止服务了(多大点事 doge),后续考虑上CDN。

地址:https://api.timelessq.com/wallpaper

4.1、请求参数

参数名 位置 类型 必填 说明
album
query
string
示例值:游戏
说明:壁纸类型:动漫、自然、游戏
format
query
string
示例值:json
说明:返回格式,不传默认重定向到图片地址

4.2、示例代码

var axios = require('axios');

var config = {
   method: 'get',
   url: 'https://api.timelessq.com/wallpaper',
   params: { 
      'album': '动漫',
      'format': 'json'
   }
};

axios(config)
.then(function (response) {
   console.log(JSON.stringify(response.data));
})
.catch(function (error) {
   console.log(error);
});

4.3、响应示例

{
  "errno": 0,
  "errmsg": "",
  "data": {
    "url": "http://img.timelessq.com/images/2022/07/23/6928788f3d68c2e7e3b92222301a30c2.png", // 图片地址
    "imageWidth": 3481, // 图片宽度
    "imageHeight": 2455, // 图片高度
    "descriptionz": "初音未来十周年" // 描述
  }
}

5、获取私有图床图片列表

地址:https://api.timelessq.com/wallpaper/list

5.1、请求参数

参数名 位置 类型 必填 说明
album
query
string
示例值:游戏
说明:壁纸类型,动漫、自然、游戏
page
query
string
示例值:1
说明:页码
pageSize
query
string
示例值:20
说明:每页个数

5.2、示例代码

var axios = require('axios');

var config = {
   method: 'get',
   url: 'https://api.timelessq.com/wallpaper/list',
   params: { 
      'album': '游戏',
      'page': 1,
      'pageSize': 20
   }
};

axios(config)
.then(function (response) {
   console.log(JSON.stringify(response.data));
})
.catch(function (error) {
   console.log(error);
});

5.3、响应示例

{
  "errno": 0,
  "errmsg": "",
  "data": {
    "count": 7,
    "totalPages": 1,
    "pageSize": 20,
    "currentPage": 1,
    "data": [
      {
        "url": "http://img.timelessq.com/images/2021/11/18/0.png", // 图片地址
        "imageWidth": 2000, // 宽度
        "imageHeight": 1205, // 高度
        "descriptionz": null // 描述
      },
      {
        "url": "http://img.timelessq.com/images/2021/11/18/27.png",
        "imageWidth": 2560,
        "imageHeight": 1440,
        "descriptionz": null
      }
    ]
  }
}

推荐阅读

恰饭区

评论区 (0)

0/500

还没有评论,快来抢第一吧