Coder Social home page Coder Social logo

heiemooa / api-tools Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 4.0 794 KB

🔥🔥🔥 一些实用的 API Tools, 如随机图片、高斯模糊缩略图、每日必应等 | Some practical API Tools, such as random pictures, Gaussian blur thumbnails, daily Bing, etc.

Home Page: https://api.emooa.com

License: MIT License

HTML 26.20% TypeScript 73.80%

api-tools's Introduction

logo

API Tools

基于 Typescript、Koa 实现的一些实用的 API 工具, 如随机图片、每日必应、本地IP等 | Some practical API Tools, such as random pictures, daily Bing, local IP, etc.

总览

🟢 状态正常 🟠 可能失效 ❌ 无法使用

功能 调用名称 状态
图片 API img 🟢
随机图片 aimg 🟢
每日必应 bing 🟢
站点状态 status 🟢
定时任务 无 <默认关闭> 🟢

启动

// 安装依赖
yarn

// 构建
yarn build

// 本地开发
yarn dev

// 云端部署
yarn start

使用

1、图片 API

  • 支持参数

    参数 属性 默认值 定义
    url string 必填 图片路径
    theme boolean 非必填 false 是否返回图片主题色
    greyscale boolean 非必填 false 是否返回灰度图片
    base64 boolean 非必填 false 是否返回 base64 图片
    quality number 非必填 100 图片质量(0-100)
    gaussian number 非必填 0 高斯模糊(0-20)
    width number 非必填 宽度(大于 0)
    height number 非必填 高度(大于 0)
  • 主题色

    GET https://example.com/img?url=$url&theme=true
  • 灰度图片

    GET https://example.com/img?url=$url&greyscale=true
  • base64

    GET https://example.com/img?url=$url&base64=true
  • 图片压缩

    GET https://example.com/img?url=$url&quality=70
  • 高斯模糊

    GET https://example.com/img?url=$url&gaussian=10
  • 缩略图

    GET https://example.com/img?url=$url&width=$width&height=$height

2、随机图片

  • 支持参数

    参数 属性 默认值 定义
    idx number 非必填 0 跳转到指定 idx 的图片,从 0 开始。0 表示当天的图片,1 表示昨天的图片,依此类推。最大值不限
    type boolean 非必填 图片类型,json(返回 json 数据)或 raw(服务端渲染返回)
  • 随机跳转一张图片

    GET https://example.com/aimg
  • 跳转到指定 idx 的图片,从 0 开始。0 表示当天的图片,1 表示昨天的图片,依此类推。最大值不限

    GET https://example.com/aimg?idx=1
  • 获取包含随机 indx 的图片信息,以 json 格式返回

    GET https://example.com/aimg?type=json
  • 获取包含指定 idx 的图片信息,以 json 格式返回

    GET https://example.com/aimg?idx=1&type=json
  • 服务端随机加载一张图片并输出

    GET https://example.com/aimg?type=raw
  • 服务端加载指定 ID 的图片并输出

    GET https://example.com/aimg?idx=1&type=raw

3、每日必应

  • 支持参数

    参数 默认 必填 说明
    uhdwidth 图宽度片
    uhdheight 图片高度
    uhd 高清与否
    n 1 获取的图片数量,最大为 8
    idx 0 获取的图片在历史记录中的索引,最大为 7
  • 详细信息

    GET https://example.com/bing

4、站点状态

反代 UptimeRobot 以实现站点监控

POST https://example.com/status

5、定时任务

目前添加了一个定时任务,支持在每天 0 点同步今日必应图片到远程 Github 文件夹

远程仓库:https://github.com/heiemooa/folder

持续添加中

Vercel 部署

现已支持 Vercel 部署,无需服务器

操作方法

  1. fork 本项目
  2. Vercel 官网点击 New Project
  3. 点击 Import Git Repository 并选择你 fork 的此项目并点击 import
  4. PROJECT NAME自己填,FRAMEWORK PRESETOther 然后直接点 Deploy 接着等部署完成即可

其他

  • 本项目为了避免频繁请求官方数据,默认对数据做了缓存处理,默认为 30 分钟,如需更改,请自行前往 utils\cache.js 文件修改
  • 本项目部分接口使用了 页面爬虫,若违反对应页面的相关规则,请 及时通知我去除该接口

免责声明

  • 本项目提供的 API 仅供开发者进行技术研究和开发测试使用。使用该 API 获取的信息仅供参考,不代表本项目对信息的准确性、可靠性、合法性、完整性作出任何承诺或保证。本项目不对任何因使用该 API 获取信息而导致的任何直接或间接损失负责。本项目保留随时更改 API 接口地址、接口协议、接口参数及其他相关内容的权利。本项目对使用者使用 API 的行为不承担任何直接或间接的法律责任
  • 本项目并未与相关信息提供方建立任何关联或合作关系,获取的信息均来自公开渠道,如因使用该 API 获取信息而产生的任何法律责任,由使用者自行承担
  • 本项目对使用 API 获取的信息进行了最大限度的筛选和整理,但不保证信息的准确性和完整性。使用 API 获取信息时,请务必自行核实信息的真实性和可靠性,谨慎处理相关事项
  • 本项目保留对 API 的随时更改、停用、限制使用等措施的权利。任何因使用本 API 产生的损失,本项目不负担任何赔偿和责任

鸣谢

  • ToolsApi 基于此项目进行修改,并 Typescript 语言化

api-tools's People

Contributors

heiemooa avatar

Stargazers

Johnson Schrodinger avatar  avatar Emooe avatar  avatar 下雨天最美~ avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.