Anime Api

何为Anime Api #

此Api皆在提供免费的公共“二次元”图片访问接口,例如:

访问https://pic.re/image可返回随机图像如下

Example

请求接口 #

接口总表

接口名 接口地址 请求方式 接口内容 范例
随机图片#1 不推荐 image GET Image /image
随机图片#2(CDN) 推荐 images GET Image /images
随机图片 images POST JSon Object /images
随机图片 images.json Get JSon Object /images.json

更新日志 #

  • 0.1.2 2023/12/17 #

    • /image 新增压缩选项为webp格式,文件体积缩小30%-60%,画面质量无明显劣化,收益明显降低宽带压力提升响应速度
    • /image 提供新尺寸参数min_size,max_size
    • 优化mongo查询过程600ms->170ms提升服务器响应速度

随机图片#1(Random Anime Image)[GET]接口 不推荐 #

接口名 请求方式 接口内容 范例
image GET Image /image
参数名 数据类型 默认值 范例 说明
nin string male, 英文逗号分割,排除的标签 常用tag表
id int 236433 图片id,使用此字段之后其他筛选条件将失效
compress true/false true true则加载webp格式图片,有效提高加载速度
mix_size int 最小尺寸 默认无最小尺寸限制
max_size int 6144 最大尺寸 默认最大不超过6144*6144,超过该尺寸需要设置此参数

默认提供https/http,get请求方式,例:

curl -I -XGET "https://pic.re/image"

除开主要的经随机筛选而来的图片内容外,额外图片信息均储存在Response Header

见响应头,除去Cloudflare CDN添加的字段以外,主要可见

HTTP/1.1 200 OK
Date: Sat, 15 May 2021 15:01:25 GMT
Content-Type: image/jpeg
Content-Length: 689008
Connection: keep-alive
image_id: 242637
image_source: https://www.pixiv.net/member_illust.php?mode=medium&illust_id=63026388
image_tags: aqua_eyes,armor,fate/extra,fate/extra_ccc,fate/grand_order,fate_(series),long_hair,meltryllis,polychromatic,purple_hair,tagme_(artist)

随机图片#2推荐!(Random Anime Image Recommend)[GET]接口 #

接口名 请求方式 接口内容 范例
images GET Image /images
参数与/image接口通用,区别是会使用301跳转到CDN地址。此接口可以很大的降低服务器压力,因此推荐使用,但是会缺少图片额外添加到header的信息,后期会考虑添加进去.

正常访问场景和#1接口无区别

Example#2

随机图片(Random Anime Image)[POST]接口 #

接口名 请求方式 接口内容 范例
image POST JSon Object /image

默认提供https/http,POST请求方式,例:

curl -XPOST "https://pic.re/image"

返回Json数据

{
    "file_url":"https://konachan.com/image/c2013204d3c186f0b95e433eea9bce15/Konachan.com%20-%20208569%20animal%20aqua_hair%20bird%20boots%20bow%20building%20city%20clouds%20gloves%20hat%20hinanawi_tenshi%20night%20red_eyes%20short_hair%20skirt_lift%20sky%20touhou%20tree%20waira%20water.jpg",
    "md5":"c2013204d3c186f0b95e433eea9bce15",
    "tags":[
        "animal",
        "aqua_hair",
        "bird",
        "boots",
        "bow",
        "building",
        "city",
        "clouds",
        "gloves",
        "hat",
        "hinanawi_tenshi",
        "night",
        "red_eyes",
        "short_hair",
        "skirt_lift",
        "sky",
        "touhou",
        "tree",
        "waira",
        "water"
    ],
    "width":2047,
    "height":1447,
    "source":"http://i4.pixiv.net/img-original/img/2015/10/24/00/31/25/53177335_p0.jpg",
    "author":"Flandre93",
    "has_children":false,
    "_id":208569
}

随机图片(Random Anime Image)[Get]接口 #

接口名 请求方式 接口内容 范例
images.json Get JSon Object /images.json
同Post接口内容

常用tag表 #

于此窥见人类之癖

  • long_hair:4089
  • original:2081
  • blush:1975
  • brown_hair:1306
  • animal_ears:1230
  • thighhighs:1163
  • short_hair:1124
  • twintails:1083
  • blonde_hair:1013
  • navel:985
  • purple_eyes:953
  • panties:943
  • red_eyes:907
  • cleavage:892
  • tail:881