首页开放API

每日一言 · 免费开放 API

无需注册 · 无需 Key · 支持 CORS 跨域 · 返回 JSON

数据来自句悦集收录的 21587 条名人名言。接入即可在自己的博客、小程序或网站展示每日金句。请求返回请保留来源字段,这是接口持续免费的条件。

1. 每日一言(按日期轮换,全站同一天返回同一句)

GET https://www.shop186.com/api/daily

{
  "errno": 0,
  "data": {
    "id": 3521,
    "text": "希望是坚韧的拐杖,忍耐是旅行袋",
    "author": "罗素",
    "url": "https://www.shop186.com/mingyan/3521.html"
  },
  "from": "句悦集 https://www.shop186.com"
}

2. 随机一句(每次请求随机返回)

GET https://www.shop186.com/api/quote

返回结构与「每日一言」相同。可选参数:?theme=lizhi 指定主题(如 lizhi 励志、dushu 读书、aiqing 爱情、shijian 时间等)。

GET https://www.shop186.com/api/quote?theme=lizhi

4. 前端接入示例

fetch("https://www.shop186.com/api/daily")
  .then(res => res.json())
  .then(d => {
    document.querySelector("#daily").textContent =
      d.data.text + " —— " + d.data.author;
  });

更多名言数据可浏览 句悦集名言大全