推荐 5 个你大概率没见过的免费 API ,一键获取数据!

40,827 阅读4分钟

免费 API 一抓一大把,本篇带来几个你不知道,但又很有趣的 几个 API !

与市面上众多 API 不同的是,这些 API :

不用任何登录!不用任何 token !不用任何购买套餐!GET 请求一键获得数据!!

ceeb653ely1g9kq3sxxh4g206o06o15i.gif

1. 猫和狗

  • 猫:

code.juejin.cn/pen/7174965…

每次点击 运行 都会获取一张喵星人照片

在浏览器中输入 api.thecatapi.com/v1/images/s… 查看返回结果,包括图片 id、url、宽、高这些信息

image.png

code.juejin.cn/pen/7174968…

每次点击 运行 都会获取一张汪星人照片

在浏览器中输入 api.thedogapi.com/v1/images/s… 查看返回结果,包括图片 id、url、宽、高这些信息

image.png

与此同时呢,官方还给出:可选择不同品种的狗的接口:

code.juejin.cn/pen/7174980…

看代码不难发现,

通过:api.thedogapi.com/v1/breeds 这个 API 可以拿到所有狗的分类信息;

然后通过:https://api.thedogapi.com/v1/images/search?include_breed=1&breed_id=' + breed_id 拿到图片;

还有更多用法,请自行在官网探索:thedogapi.com/#pricing

2. 名言警句

Random Quote API 提供了一个用来获取随机名言的 API,可以用来测试文本处理能力。

Github 项目地址:github.com/lukePeavey/…

比如任意获取一句名言:api.quotable.io/random

得到:

{  
    "_id":"UydvuUuGWjGo",  
    "content":"We read the world wrong and say that it deceives us.",  
    "author":"Rabindranath Tagore",  
    "tags":**[  
        "famous-quotes"  
    ],  
    "authorSlug":"rabindranath-tagore",  
    "length":52,  
    "dateAdded":"2020-04-14",  
    "dateModified":"2020-04-14"  
}

还有一些其它参数可供选用:

image.png

这个项目是英文;

中文名言警句 API 也有:

api.xygeng.cn/one

返回:

{  
    "code":200,  
    "data":**{  
        "id":800,  
        "tag":"动画",  
        "name":"佚名",  
        "origin":"《罪恶王冠》",  
        "content":"温柔解救不了这个世界",  
        "created_at":"2019-01-23T07:58:03+00:00",  
        "updated_at":"2022-03-09T08:42:10+00:00"  
    },  
    "updateTime":1670569646019  
}

3. 用户信息

Random User Generator:提供了一个用来生成随机用户数据的 API,可以用来测试用户管理功能。

官网:randomuser.me/

image.png

示例:

randomuser.me/api/

返回:

{  
    "results":**[  
        **{  
            "gender":"male",  
            "name":**{  
                "title":"Mr",  
                "first":"Liam",  
                "last":"Shelton"  
            },  
            "location":**{  
                "street":**{  
                    "number":2481,  
                    "name":"The Drive"  
                },  
                "city":"Tipperary",  
                "state":"Offaly",  
                "country":"Ireland",  
                "postcode":37431,  
                "coordinates":**{  
                    "latitude":"3.2413",  
                    "longitude":"-168.0368"  
                },  
                "timezone":**{  
                    "offset":"+4:30",  
                    "description":"Kabul"  
                }  
            },  
            "email":"liam.shelton@example.com",  
            "login":**{  
                "uuid":"ada3deb4-99bf-42c4-acb8-c4653145f3e7",  
                "username":"redlion786",  
                "password":"sentnece",  
                "salt":"JKR7kVq4",  
                "md5":"efe8e8d3c78863c910625418fd6b212b",  
                "sha1":"22aabc3bccc7891ae62815164dcc5f020cc67b24",  
                "sha256":"0ef108e6a758db207f73ddc190189dac2e5a849206ad47dca7842d3d2f927c05"  
            },  
            "dob":**{  
                "date":"1962-05-03T23:20:34.105Z",  
                "age":60  
            },  
            "registered":**{  
                "date":"2010-07-10T14:38:40.859Z",  
                "age":12  
            },  
            "phone":"021-123-9294",  
            "cell":"081-143-0111",  
            "id":**{  
                "name":"PPS",  
                "value":"4570229T"  
            },  
            "picture":**{  
                "large":"<https://randomuser.me/api/portraits/men/33.jpg>",  
                "medium":"<https://randomuser.me/api/portraits/med/men/33.jpg>",  
                "thumbnail":"<https://randomuser.me/api/portraits/thumb/men/33.jpg>"  
            },  
            "nat":"IE"  
        }  
    ],  
    "info":**{  
        "seed":"eee03283804d179d",  
        "results":1,  
        "page":1,  
        "version":"1.4"  
    }  
}

可以看到,返回的个人的信息非常全;

也支持获取多人用户信息:randomuser.me/api/?result…

4. 讲个笑话

Chuck Norris API:提供了一系列关于 Chuck Norris 的笑话和引用,可以用来做一些有趣的测试。

官网:api.chucknorris.io/

image.png

这图配的挺搞笑的~~

API: api.chucknorris.io/jokes/rando…

返回:

{
"icon_url" : "https://assets.chucknorris.host/img/avatar/chuck-norris.png",
"id" : "BiKqA8enQ9uUZ4VUsQjgUA",
"url" : "",
"value" : "Chuck Norris once gave someone 8 seconds to live. That person is now known as the Rage Guy. URL=http://www.youtube.com/watch?v=E29iOPSxF94&NR=1&feature=fvwp"
}

中文笑话 API : api.vvhan.com/api/joke

返回:

劫匪成功劫持一辆押运车。回去后,一新来劫匪说:“老大我们数一下抢了多少钱。”那老大说:“没经验吧!这么多要数到啥时候,看看新闻不就知道了吗?”打开电视一看,傻眼了:“今日发生一起劫匪劫持高考试卷事件!”

虽然,一点不好笑。。。。。。

5. 随机问答

Open Trivia Database API:可以用来获取各类的问题和答案,可以用来制作小游戏或者知识问答类应用。

官网:opentdb.com/api_config.…

image.png

你可以自由配置问题,然后一件生成:

比如:生成 3 个 关于 电影话题的简单难度、且有多选的问答,链接如下:

opentdb.com/api.php?amo…

{  
    "response_code":0,  
    "results":[  
        {  
            "category":"Entertainment: Film",  
            "type":"multiple",  
            "difficulty":"easy",  
            "question":"When was the movie 'Con Air' released?",  
            "correct_answer":"1997",  
            "incorrect_answers":**[  
                "1985",  
                "1999",  
                "1990"  
            ]  
        },  
        {  
            "category":"Entertainment: Film",  
            "type":"multiple",  
            "difficulty":"easy",  
            "question":"What is the orange and white bot's name in "Star WarsThe Force Awakens"?",  
            "correct_answer":"BB-8",  
            "incorrect_answers":[  
                "BB-3",  
                "AA-A",  
                "R2-D2"  
            ]  
        },  
        {  
            "category":"Entertainment: Film",  
            "type":"multiple",  
            "difficulty":"easy",  
            "question":"In "ALF", what was ALF's real name?",  
            "correct_answer":"Gordon Shumway",  
            "incorrect_answers":**[  
                "Gordon Milipp",  
                "Gordon Foster",  
                "Gordon von Gam"  
            ]  
        }  
    ]  
}

以上这些 api 直接能拿到调测使用,挺好的~~


OK,以上便是本篇分享,希望各位工友喜欢~ 欢迎点赞、收藏、评论 🤟

我是掘金安东尼 🤠 100 万人气前端技术博主 💥 INFP 写作人格坚持 1000 日更文 ✍ 关注我,安东尼陪你一起度过漫长编程岁月 🌏

😹 加我微信 ATAR53,拉你入群,定期抽奖、粉丝福利多多。只学习交友、不推文卖课~

😸 我的公众号:掘金安东尼,在上面,不止编程,更多还有生活感悟~

😺 我的 GithubPage: tuaran.github.io,它已经被维护 4 年+ 啦~


本文正在参加「金石计划 . 瓜分6万现金大奖」