图片API合集&&Python批量下载API图片

1、api接口整合

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

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

樱道:https://api.r10086.com/img-api.php?type=动漫综合1

小歪:https://api.ixiaowai.cn/api/api2.php

保罗:https://api.paugram.com/wallpape

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

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

likepoems随机图:https://api.likepoems.com/img/mc

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

缙哥哥博客: https://api.dujin.org/pic/yuanshen/

COS:https://imgapi.cn/cos.php

在线古风美图:https://cdn.seovx.com/?mom=302

2、api网站整合

2.1 搏天

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

调用地址:https://api.btstu.cn/sjbz/api.php

2.2 樱道

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

调用地址:

二次元动漫(1-18):https://api.r10086.com/img-api.php?type=动漫综合1

东京食尸鬼(横竖屏):https://api.r10086.com/img-api.php?type=东京食尸鬼横屏系列1

Fate(横竖屏):https://api.r10086.com/img-api.php?type=Fate横屏系列1

为美好世界献上祝福(横竖屏):https://api.r10086.com/img-api.php?type=为美好世界献上祝福横屏系列1

某科学的超电磁炮(横竖屏):https://api.r10086.com/img-api.php?type=某科学的超电磁炮横屏系列1

原神(横竖屏):https://api.r10086.com/img-api.php?type=原神横屏系列1

我的世界:https://api.r10086.com/img-api.php?type=我的世界系列1

神奇宝贝(横竖屏):https://api.r10086.com/img-api.php?type=神奇宝贝横屏系列1

龙珠(横竖屏):https://api.r10086.com/img-api.php?type=龙珠横屏系列1

罪恶王冠(横竖屏):https://api.r10086.com/img-api.php?type=罪恶王冠横屏系列1

鬼灭之刃(横竖屏):https://api.r10086.com/img-api.php?type=鬼灭之刃横屏系列1

火影忍者(横竖屏):https://api.r10086.com/img-api.php?type=火影忍者横屏系列1

海贼王(横竖屏):https://api.r10086.com/img-api.php?type=海贼王横屏系列1

进击的巨人(横竖屏):https://api.r10086.com/img-api.php?type=进击的巨人横屏系列1

从零开始的异世界生活(横竖屏):

https://api.r10086.com/img-api.php?type=从零开始的异世界生活横屏系列1

刀剑神域(横竖屏):https://api.r10086.com/img-api.php?type=刀剑神域横屏系列1

钢之炼金术师(横竖屏):https://api.r10086.com/img-api.php?type=钢之炼金术师横屏系列1

妖精的尾巴(横竖屏):https://api.r10086.com/img-api.php?type=妖精的尾巴横屏系列1

缘之空(横竖屏):https://api.r10086.com/img-api.php?type=缘之空横屏系列1

东方project:https://api.r10086.com/img-api.php?type=东方project1

猫娘:https://api.r10086.com/img-api.php?type=猫娘1

风景(1-10):https://api.r10086.com/img-api.php?type=风景系列1

物语(1-2):https://api.r10086.com/img-api.php?type=物语系列1

少女前线:https://api.r10086.com/img-api.php?type=少女前线1

明日方舟(1-2):https://api.r10086.com/img-api.php?type=明日方舟1

重装战姬:https://api.r10086.com/img-api.php?type=重装战姬1

P站(1-4):https://api.r10086.com/img-api.php?type=P站系列1

CG(1-5):https://api.r10086.com/img-api.php?type=CG系列1

守望先锋:https://api.r10086.com/img-api.php?type=守望先锋

王者荣耀:https://api.r10086.com/img-api.php?type=王者荣耀

少女写真(1-6):https://api.r10086.com/img-api.php?type=少女写真1

死库水萝莉:https://api.r10086.com/img-api.php?type=死库水萝莉

萝莉:https://api.r10086.com/img-api.php?type=萝莉

极品美女图片:https://api.r10086.com/img-api.php?type=极品美女图片

日本COS中国COS:https://api.r10086.com/img-api.php?type=日本COS中国COS

橘里橘气(横竖屏):https://api.r10086.com/img-api.php?type=橘里橘气横屏系列1

 

3、Python批量下载API图片

Docker 部署Python环境

#python执行下面代码即可

import os
import requests
#api地址
#例如搏天
url = "https://api.ghser.com/random/api.php"
#root后面是图片下载后保存路径,如果是win就得加上盘符
root = "./img"
a = int(input('请输入爬取数量:'))
i = 1
while i <= a:
    i += 1
    surl = requests.get(url).url
    path = root + surl.split("/")[-1]
    try:
        if not os.path.exists(root):
            os.mkdir(root)
        if not os.path.exists(path):
            r = requests.get(surl)
            with open(path, "wb") as f:
                f.write(r.content)
                f.close()
                print("图片",(i-1),"文件保存成功")
        else:
            print("tips:存在同名文件")
    except:
        print("error:✘存在异常错误")
posted @ 2023-08-28 15:00  Kannic  阅读(159)  评论(0编辑  收藏  举报