xkcd
以 JSON 格式获取 xkcd 漫画
- 认证方式
- No auth
- HTTPS
- Yes
- CORS
- No
- 分类
- 游戏与漫画
- 文档 / URL
- https://xkcd.com/json.html
简介
xkcd——Randall Munroe 创作的经典网络漫画——把每幅漫画都以简洁的 JSON 文档公开。该接口无需 API 密钥,也没有文档化的速率限制,是“每日一漫画”小组件、趣味 API 演示和彩蛋的经典选择。
快速开始
最新漫画(实测可用——返回当前条目的数据):
curl "https://xkcd.com/info.0.json"
按编号获取指定漫画:
curl "https://xkcd.com/327/info.0.json"
JSON 紧凑且一目了然:
{
"month": "8",
"num": 3288,
"year": "2026",
"safe_title": "Archery Feat",
"alt": "Update: I would not have embarked on this powerscaling venture...",
"img": "https://imgs.xkcd.com/comics/archery_feat.png",
"title": "Archery Feat",
"day": "21"
}
每幅漫画包含
num——漫画编号(稳定 ID)title/safe_title——标题(safe_title 去掉了特殊字符)img——imgs.xkcd.com上的图片直链(支持热链)alt——鼠标悬停文本(往往是最精彩的部分!)transcript——文字转写(可用时)year/month/day——发布日期
认证方式
无需认证——免密钥开放。
速率限制与注意事项
- 没有文档化的硬性限制,但这是免费服务——高频轮询请缓存 JSON(漫画每天只更新一次)。
- 最新漫画接口会告诉你当前编号;从它向下遍历即可获取历史存档。
- 从
imgs.xkcd.com热链图片就是官方预期的用法。 - CORS 不保证——浏览器小组件建议走自己的服务端或小型代理。
常见问题
xkcd API 免费吗? 是的——免费、免密钥、免注册。
如何获取指定漫画?
https://xkcd.com/{编号}/info.0.json。
可以热链图片吗?
可以——imgs.xkcd.com 的 URL 就是设计用来直接嵌入的。
游戏与漫画 分类更多
| API | Auth | HTTPS | CORS | |
|---|---|---|---|---|
| AmiiboAPI Nintendo Amiibo Information | No auth | Yes | Yes | ↗ |
| Animal Crossing: New Horizons API for critters, fossils, art, music, furniture and villagers | No auth | Yes | Unknown | ↗ |
| Astroworld Free Minecraft data: mobs, biomes, items, enchantments, structures, commands, versions, achievements, trades | No auth | Yes | Yes | ↗ |
| Autochess VNG Rest Api for Autochess VNG | No auth | Yes | Yes | ↗ |
| Barter.VG Provides information about Game, DLC, Bundles, Giveaways, Trading | No auth | Yes | Yes | ↗ |