自建API及使用方式

手搓教程2个月前更新 DoTing
580 00

一言API

https://api.ake.cx/yiyan/

请求示例 GET

https://api.ake.cx/yiyan/?format=js

返回数据

404 Not Found

404 Not Found


nginx

 

引用代码

<script src=”https://api.ake.cx/yiyan/?format=js”></script>

自定义参数

参数名参数值可选/必填描述
formattext默认返回文本格式
formatjs可选返回document.write格式
formatjson可选返回json格式
typedujitang可选毒鸡汤语录
typetiangou可选添狗语录
typeqinghua可选情话语录

QQ头像获取API

https://api.ake.cx/qqimg/

请求示例 GET

https://api.ake.cx/qqimg/?qq=2637033514

返回数据

404 Not Found

404 Not Found


nginx

 

自定义参数

参数名参数值可选/必填描述
qqQQ号码必填返回文本格式

随机图片API

https://api.ake.cx/images/

请求实例

https://api.ake.cx/images/?Category=anime

返回结果

404 Not Found

404 Not Found


nginx

 

自定义参数

参数名参数值可选/必填描述
idnumber可选如ID对应图片不存在则随机返回一张图片
Categorydata默认所有类别
Categoryanime可选动漫图
Categorynature可选风景图
typejson可选以json返回
typequantity可选返回图片总数
typestring可选返回主图

ProxyPool 爬虫代理IP池

https://ip.api.ake.cx/

请求实例

https://ip.api.ake.cx/get

返回结果


404 Not Found

404 Not Found


nginx

自定义参数

apimethodDescriptionparams
/GETapi介绍None
/getGET随机获取一个代理可选参数: ?type=https 过滤支持https的代理
/allGET获取所有代理可选参数: ?type=https 过滤支持https的代理
/countGET查看代理数量None
隐藏内容!
不可用
密码验证后才能查看!

 

Python实例

如果要在爬虫代码中使用的话, 可以将此api封装成函数直接使用,例如:

import requests
​
def get_proxy():
    return requests.get("https://ippool.ake.cx/get/").json()
​
def delete_proxy(proxy):
    requests.get("https://ippool.ake.cx/delete/?proxy={}".format(proxy))
​
def getHtml():
    # ....
    retry_count = 5
    proxy = get_proxy().get("proxy")
    while retry_count > 0:
        try:
            html = requests.get('http://www.example.com', proxies={"http": "http://{}".format(proxy)})
            # 使用代理访问
            return html
        except Exception:
            retry_count -= 1
    # 删除代理池中代理
    delete_proxy(proxy)
    return None

Proxy代理网站

https://proxy.ake.cx/ 可访问狗歌,如需高速节点可联系站长

请求实例

https://proxypool.ake.cx/proxy/https://google.com

ChatGPT代理

https://chatgpt.ake.cx/

Github镜像站

https://git.ake.cx/ 直接访问即可

Hot热榜

https://hot.api.ake.cx/

请求实例

https://hot.api.ake.cx/bilibili

返回结果


404 Not Found

404 Not Found


nginx

自定义参数

✅ 状态正常  /❌ 无法使用 /⚠️ 需要科学上网
参数值描述榜单类型状态
bilibili哔哩哔哩热门榜
acfunAcFun排行榜
weibo微博热搜榜
zhihu知乎热榜
zhihu-daily知乎日报推荐榜
baidu百度热搜榜
douyin抖音热点榜
douban-movie豆瓣电影新片榜
douban-group豆瓣讨论小组讨论精选
tieba百度贴吧热议榜
sspai少数派热榜
ithomeIT之家热榜
ithome-xijiayiIT之家「喜加一」最新动态
jianshu简书热门推荐
thepaper澎湃新闻热榜
toutiao今日头条热榜
36kr36 氪热榜
51cto51CTO推荐榜
juejin稀土掘金热榜
qq-news腾讯新闻热点榜
netease-news网易新闻热点榜
lol英雄联盟更新公告
genshin原神最新消息
honkai崩坏3最新动态
starrail崩坏:星穹铁道最新动态
weread微信读书飙升榜
ngabbsNGA热帖
v2exV2EX主题榜⚠️
hellogithubHelloGitHubTrending
weatheralarm中央气象台全国气象预警
earthquake中国地震台地震速报

可选参数

多参数调用可用`&`链接

参数名参数描述示例
?limit10榜单返回数量/bilibili?limit=10
?rssTRUERSS模式/bilibili?rss=true
?cacheFALSE实时采集/bilibili?cache=false
© 版权声明

相关文章

暂无评论

none
暂无评论...