ChenYFanの公开API

简介

ChenYFanのAPI,是搭建在CloudFlareWorker无服务器上的高可用动态API,每天支持10万次高频率调用,计算时间少于10ms。

目前尚无限制计划。

部分API需要APIKey才能正常使用,捐赠10¥【法币用爱发电,虚拟货币按照先兑换成USDT,再按美元价格计算,价格按照捐赠时的计算】即可获得永久一枚,使用爱发电可以自动签发,其他支付方式请主动用Telegram联系@ChenYFan

使用APIKEY统一方式在url上传参数为

参数 意义
pro true 表明以PRO方式访问
apikey xxx-xxx-xxx 传递APIKEY

如以下格式

https://api.cyfan.top/acg?pro=true&apikey=xxx-xxx-xxx

不合法的APIKEY会在CloudFlareWAF层面拦截,错误次数过高会被WAF封禁,所以请不要妄想暴力破解

本API是不开源的

使用

娱乐向

必应壁纸

https://api.cyfan.top/bing

参数 参数用途
day 获取壁纸距今的日期,今日为1
type 返回格式,为json返回json格式,否则返回图片形式
https://api.cyfan.top/bing
https://api.cyfan.top/bing?day=2
https://api.cyfan.top/bing?day=3&type=json

ACG动漫图片

https://api.cyfan.top/acg

部分功能需要APIKey

参数 参数用途
pro true时开启R18限制级,注意,此功能必须提供APIKey
type 支持bgpic,前者将返回ACG动漫背景图片,后者返回角色图片,不合法时将随机返回
restype 允许为cdnwsjsonimg,缺省为img
cdn模式下num无效,不能在r18true时开启,api返回一个301链接,通常是jsdelivr加速链接
ws模式下所有的数据将通过WebSocket以二进制流传输,这可以帮助您更快的获取更多的图片
json模式不能在r18true时开启,此模式可以帮助您更好地构建其他中继程序
img模式下num无效,api将直接返回一张图片
num wsjson模式为true时,并且r18为false时,返回的总数据量,最多支持10张,使用APIKEY可以提升至100张
https://api.cyfan.top/acg
https://api.cyfan.top/acg?type=bg
https://api.cyfan.top/acg?type=pic&restype=cdn
https://api.cyfan.top/acg?type=bg&restype=json&num=15
wss://api.cyfan.top/acg?type=pic&r18=true&num=5&restype=ws&apikey=xxx

唐诗宋词API

https://api.cyfan.top/poet

参数名 参数作用 参数值
type 选择唐诗还是宋词,留空唐诗 tang or song
from 从第几个诗词样本开始取,留空随机 tang1~254
song1~57
with 该样本中的第with+1首诗,留空随机 0~999
limit 获取句数限制,留空为99即所有,超过原来诗词长度则按原来长度计算 99
start 从第start+1句诗开始获取,留空为0 0
tran 是否进行翻译,为true则翻译,默认为true true or false
author 是否显示作者,为true则显示,默认为true true or false
img 是否以图片形式返回,建议同时用limit参数限制长度 true or false
https://api.cyfan.top/poet
https://api.cyfan.top/poet?limit=1
https://api.cyfan.top/poet?limit=2&start=2
https://api.cyfan.top/poet?tran=false
https://api.cyfan.top/poet?tran=false&author=true
https://api.cyfan.top/poet?img=true&limit=2

工具类

二维码生成

https://api.cyfan.top/qrcode

参数 参数用途
code 二维码内容
size 图片大小,默认200px
https://api.cyfan.top/qrcode?code=https://xuexi.cn
https://api.cyfan.top/qrcode?code=https://baidu.com&size=1000

百度收录查询

百度nmsl

https://api.cyfan.top/baiduseo

参数 参数用途
type 查询模式,all为查询此域名共收录多少,single为查询单页面有没有收录
url 查询模式为single时生效,为目标网站网址
domain 查询模式为all时生效,为目标网站域名
https://api.cyfan.top/baiduseo?type=all&domain=cyfan.top
https://api.cyfan.top/baiduseo?type=single&type=https://blog.cyfan.top/114514.html

几个不得不说的点

  1. 由于Worker出口节点在国外,通常收录量会比国内查询到的要多一点
  2. 当请求过于频繁的时候可能会被百度人机验证,请等待。

网站缩略图

https://api.cyfan.top/thumb

参数 参数用途
url 目标网站网址
width 图片宽度,不得大于1200px,默认1024px
height 图片宽度,(height/width)*1200不得大于1200px,默认768px
zip 默认是不压缩的,为true时返回体积更小【质量更差】的截图
wait 载入后等待时间,默认为2s
https://api.cyfan.top/thumb?url=https://blog.cyfan.top
https://api.cyfan.top/thumb?url=https://google.com&zip=true
https://api.cyfan.top/thumb?url=https://baidu.com&width=1024&height=1024
https://api.cyfan.top/thumb?url=https://cyfan.top&wait=10

云端渲染MarkDown

https://api.cyfan.top/mark

参数 参数用途
url 目标md地址
https://api.cyfan.top/mark?url=https://cdn.jsdelivr.net/gh/ChenYFan/blog/source/_posts/how-to-use-euserv.md

网站ICON获取

https://api.cyfan.top/icon

参数 参数用途
domain 目标网站域名
https://api.cyfan.top/icon?domain=baidu.com

简繁快速翻译

https://api.cyfan.top/ttontran

参数 参数用途
ctx 需翻译的文字
type toHans翻译到简体
toTans翻译到繁体

虚拟头像生成

https://api.cyfan.top/avatar

参数 参数用途
acg true时返回ACG头像
https://api.cyfan.top/avatar
https://api.cyfan.top/avatar?acg=true