侧边栏壁纸
  • 累计撰写 75 篇文章
  • 累计收到 224 条评论
    love love love

api接口整合

李哲
2022-05-21 / 0 评论 / 108,229 阅读 / 正在检测是否收录...
温馨提示:
本文最后更新于2023年09月28日,已超过203天没有更新,若内容或图片失效,请留言反馈。

樱花:https://www.dmoe.cc/random.php

晓晴博客:https://acg.toubiec.cn/random.php

Unsplash Image API:https://source.unsplash.com/random

夏沫博客:
https://cdn.seovx.com/?mom=302
https://cdn.seovx.com/d/?mom=302
https://cdn.seovx.com/ha/?mom=302

搏天api:https://api.btstu.cn/sjbz/api.php

姬长信API:
----每日bing:https://api.isoyu.com/bing_images.php
----美女图片壁纸:https://api.isoyu.com/mm_images.php
----网红专栏壁纸:https://api.isoyu.com/beibei_images.php
----动态IP签名图片:https://api.isoyu.com/ip_images.php?signature=早安
----ARU(阿鲁)表情包:https://api.isoyu.com/ARU_GIF_S.php

樱道:https://api.r10086.com/动漫综合1.php (网站中有更多api接口)

小歪API:
----二次元动漫:https://api.ixiaowai.cn/api/api.php
----mc酱动漫:https://api.ixiaowai.cn/mcapi/mcapi.php
----高清壁纸:https://api.ixiaowai.cn/gqapi/gqapi.php

保罗|API:https://api.paugram.com/wallpaper/

墨天逸:https://api.mtyqx.cn/tapi/random.php

EEE.DOG:https://api.yimian.xyz/img

岁月小筑:https://img.xjh.me/random_img.php

东方Project:https://img.paulzzh.tech/touhou/random

xyg随即图:https://api.likepoems.com/

星港随机图片API:https://xg.x-xh.cn/?p=251(网站中有更多api接口)

2、api网站整合
2.1 樱花
网址:https://www.dmoe.cc/

  • 随机二次元图片API

2.2 晓晴博客

网址:https://www.toubiec.cn/318.html

  • 随机二次元图片接口

源码项目地址:https://www.toubiec.cn/99.html

2.3 Unsplash Image API

官方网址:https://source.unsplash.com/

API地址:https://source.unsplash.com/random

  • 简单的嵌入Unsplash图片,可以登录Unsplash账号设置,也可以自定义筛选接口的图片类型

2.4 夏沫博客

网址:https://cdn.seovx.com/

  • 在线古风美图二次元API接口

2.5 搏天api

网址:https://api.btstu.cn/doc/sjbz.php

  • 随机输出各类壁纸

2.6 姬长信API

网址:https://api.isoyu.com/

  • 姬长信API For Docker 一个基于多种编程语言开源免费不限制提供生活常用,出行服务,开发工具,金融服务,通讯服务和公益大数据的平台.

2.7 樱道

网址:https://img.r10086.com/

  • の随机图片API接口ฅ•ﻌ•ฅ

2.8 小歪API

网址:https://api.ixiaowai.cn/

  • 图片API,文字API,二维码API,随心所动不再单调

2.9 保罗|API

网址:https://api.paugram.com/help/wallpaper

  • 生成适合 Single 主题的白底动漫壁纸

2.10 墨天逸

网址:https://api.mtyqx.cn/

  • 随机图片API

2.11 EEE.DOG

网址:https://www.eee.dog/tech/rand-pic-api.html

  • 本API基于华为云对象存储,使用华为CDN云加速,全球平均下载速度达10MB/s。API中已收录1100+张二次元图片,20+张Bing壁纸(每日自动抓取),150+张二次元头像,10+张图床上传图片。

2.12 岁月小筑

网址:https://img.xjh.me/

  • 随机图片API

2.13 东方Project

网址:https://img.paulzzh.tech/

  • 随机图片API

2.14 xyg随即图(本站)

网址:https://api.likepoems.com/

  • 随机图片API

2.15 星港随机图片API

网址:https://xg.x-xh.cn/?p=251

  • 随机图片API

3、自建随机图api

准备图片—>书写路径—>书写php文件
在img文件夹里新建 img.txt ,文件中直接写图片的URL地址,如:

https://static.likepoems.com/2020/09/19/14d4607426a4a4e341f8144a56fbac570.jpg
https://static.likepoems.com/2020/09/19/ad30a36bd3c3d6bfd07f0357fa25ab710.jpg

新建 index.php 文件。文件内容如下:

<?php
//存放api随机图链接的文件名img.txt
$filename = "img.txt";
if(!file_exists($filename)){
    die('文件不存在');
}

//从文本获取链接
$pics = [];
$fs = fopen($filename, "r");
while(!feof($fs)){
    $line=trim(fgets($fs));
    if($line!=''){
        array_push($pics, $line);
    }
}

//从数组随机获取链接
$pic = $pics[array_rand($pics)];

//返回指定格式
$type=$_GET['type'];
switch($type){

//JSON返回
case 'json':
    header('Content-type:text/json');
    die(json_encode(['pic'=>$pic]));

default:
    die(header("Location: $pic"));
}

?>

然后放在服务器里面的api文件夹里,绑定域名,记得开启php环境
访问路径:你的域名 /api/img

28,563

评论 (0)

取消