假定您的 Worker 路由是 https://example.workers.dev/。
浏览器访问 https://example.workers.dev/
这里列举了几个 开放 API 接口,实际上不止这几个,详见源码。
笔者在这里简单列举一下。
必应图片
API 路径: https://example.workers.dev/bing
参数:?day=<Number>
0-6,0 表示今天,1 表示明天,依次类推。
https://example.workers.dev/bing?day=3 获取图片https://example.workers.dev/bing/info?day=3 获取图片详细信息https://example.workers.dev/bing/copyright?day=3 获取图片版权信息
Unsplash 图片
API 路径: https://example.workers.dev/unsplash
参数:?keywords=<S>,<S>,<S>
https://example.workers.dev/unsplash?keywords=cat,dog,bird
OPEN CDN
API 路径:
https://example.workers.dev/npm/ :unpkg.comhttps://example.workers.dev/gh/ :fastly.jsdelivr.nethttps://example.workers.dev/wp/ :fastly.jsdelivr.nethttps://example.workers.dev/twemoji/ :twemoji.maxcdn.comhttps://example.workers.dev/gitraw/ :raw.githubusercontent.comhttps://example.workers.dev/gist/ :gist.github.comhttps://example.workers.dev/ajax/libs/ :cdnjs.cloudflare.com
DNS 查询
API 路径: https://example.workers.dev/dns/ali/get/host?name=github.com
/dns/:upstream:/:way:/:host:?name=xxx&type=xxx&edns_client_subnet=x.x.x.x/dns/dns/get/dns/ali/get/host
| 参数 | 参数用途 |
|---|---|
| name | 需要解析的域名 |
| type | 解析形式,A or AAAA or CNAME 等等 |
| edns_client_subnet | EDNS 的 ip, 默认开启为本机 ip, 开启此项功能可提高解析精准度. |
| way | 获取方式,默认 doh 方式,可使用以下参数: doh get |
| host | 是否转化为 host 格式 [仅在 type 为 A 或 AAAA 格式下生效] |
| upstream | 上游 DNS 解析,默认为 CloudFlare 回源 < 1ms 可使用以下参数: google ali dnspod |
注:DoH 推荐直接选用 https://dns.alidns.com/dns-query ,而不是用本 API 的反代接口