分享一些壁纸api
搜索接口
import requests
url = "https://wp.shanhutech.cn/intf/GetUpOrDownWallpaper"
querystring = {"type":"search","action":"","value":"原神","id":"2051093"}
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36"}
response = requests.request("POST", url, headers=headers, params=querystring)
print(response.text)
最新
import requests
url = "https://shcdn-wp.shanhutech.cn/intf/newestList"
querystring = {"pageno":"1","count":"10"}
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36"}
response = requests.request("POST", url, headers=headers, params=querystring)
print(response.text)
类别
参数说明,可以导入apipost中
[
{
"description": "",
"is_checked": 1,
"key": "pageno",
"type": "Text",
"not_null": 1,
"field_type": "String",
"value": "20"
},
{
"description": "",
"is_checked": 1,
"key": "count",
"type": "Text",
"not_null": 1,
"field_type": "String",
"value": "20"
},
{
"description": "",
"field_type": "String",
"is_checked": -1,
"key": "tag",
"value": "清纯",
"not_null": 1,
"type": "Text"
},
{
"description": "4K专区 ",
"is_checked": -1,
"key": "cids",
"type": "Text",
"not_null": 1,
"field_type": "String",
"value": "36"
},
{
"description": "美女模特",
"field_type": "String",
"is_checked": -1,
"key": "cids",
"value": "6",
"not_null": 1,
"type": "Text"
},
{
"description": "爱情",
"field_type": "String",
"is_checked": -1,
"key": "cids",
"value": "30",
"not_null": 1,
"type": "Text"
},
{
"description": "风景",
"field_type": "String",
"is_checked": -1,
"key": "cids",
"value": "9",
"not_null": 1,
"type": "Text"
},
{
"description": "小清新",
"field_type": "String",
"is_checked": -1,
"key": "cids",
"value": "15",
"not_null": 1,
"type": "Text"
},
{
"description": "动漫",
"field_type": "String",
"is_checked": 1,
"key": "cids",
"value": "26",
"not_null": 1,
"type": "Text"
},
{
"description": "明星",
"field_type": "String",
"is_checked": -1,
"key": "cids",
"value": "11",
"not_null": 1,
"type": "Text"
},
{
"description": "萌宠",
"field_type": "String",
"is_checked": -1,
"key": "cids",
"value": "14",
"not_null": 1,
"type": "Text"
},
{
"description": "游戏",
"field_type": "String",
"is_checked": -1,
"key": "cids",
"value": "5",
"not_null": 1,
"type": "Text"
},
{
"description": "汽车",
"field_type": "String",
"is_checked": -1,
"key": "cids",
"value": "12",
"not_null": 1,
"type": "Text"
},
{
"description": "炫酷时尚",
"field_type": "String",
"is_checked": -1,
"key": "cids",
"value": "10",
"not_null": 1,
"type": "Text"
},
{
"description": "日历壁纸",
"field_type": "String",
"is_checked": -1,
"key": "cids",
"value": "29",
"not_null": 1,
"type": "Text"
},
{
"description": "影视剧照",
"field_type": "String",
"is_checked": -1,
"key": "cids",
"value": "7",
"not_null": 1,
"type": "Text"
},
{
"description": "节日美图",
"field_type": "String",
"is_checked": -1,
"key": "cids",
"value": "13",
"not_null": 1,
"type": "Text"
},
{
"description": "军事天地",
"field_type": "String",
"is_checked": -1,
"key": "cids",
"value": "22",
"not_null": 1,
"type": "Text"
},
{
"description": "劲爆体育",
"field_type": "String",
"is_checked": -1,
"key": "cids",
"value": "16",
"not_null": 1,
"type": "Text"
},
{
"description": "BABY秀",
"field_type": "String",
"is_checked": -1,
"key": "cids",
"value": "18",
"not_null": 1,
"type": "Text"
},
{
"description": "文字控",
"field_type": "String",
"is_checked": -1,
"key": "cids",
"value": "35",
"not_null": 1,
"type": "Text"
}
]
请求示例
import requests
url = "https://wp.shanhutech.cn/intf/GetListByCategory"
querystring = {"pageno":"20","count":"20","cids":"26"}
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
壁纸详情
import requests
url = "https://wp.shanhutech.cn/intf/GetUpOrDownWallpaper"
querystring = {"type":"newest","action":"","value":"","id":"2062166"} # id: 壁纸id
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36"}
response = requests.request("GET", url, headers=headers, params=querystring)
print(response.text)
整合
上面的接口整合一下
# coding: utf-8
# 小鸟壁纸
from typing import Union
import requests
from qfluentwidgets.common.exception_handler import exceptionHandler
from common import cfg, EnumBase
XiaoNiaoBaseUrl = 'https://wp.shanhutech.cn/intf'
class MeiNv(EnumBase):
QingChun = '清纯'
XingGan = '性感女神'
OuMei = '欧美女神'
WenYi = '文艺古风'
@staticmethod
def type():
return '美女模特'
class AiQing(EnumBase):
AiQing = '爱情箴言'
LangMan = '浪漫手绘'
XinDong = '心动创意'
WeiMei = '唯美温警'
@staticmethod
def type():
return '爱情'
class FengJing(EnumBase):
LanTian = '蓝天白云'
LuoRi = '落日余晖'
Chun = '春意盎然'
Xia = '炎炎夏日'
Qiu = '秋意正浓'
Bing = '冰天雪地'
ChengShi = '城市夜景'
HaiYang = '海洋天堂'
ZiRan = '自然风光'
QiHuan = '奇幻梦境'
@staticmethod
def type():
return '风景'
class XiaoQingXin(EnumBase):
HuYan = '护眼壁纸'
ShuHuan = '舒缓压力'
WenXin = '温馨一刻'
QingXin = '清新淡雅'
JingWu = '静物写真'
Niao = '鸟语花香'
DongGan = '动感水果'
JiaoYan = '娇艳欲滴'
@staticmethod
def type():
return '小清新'
class DongMan(EnumBase):
GuoMan = '国漫'
LongZhu = '龙珠'
HaiZei = '海贼王'
HuoYing = '火影忍者'
QinShi = '秦时明月'
JuRen = '进击巨人'
ShiShi = '食尸鬼'
KaTong = '卡通人物'
@staticmethod
def type():
return '动漫'
class MengChong(EnumBase):
GuLingJingGuai = '古灵精怪'
YeSheng = '野生动物'
JiDi = '极地物种'
Gou = '汪星人'
Mao = '喵星人'
MaiMeng = '卖萌图'
Hai = '海底世界'
Niao = '小鸟天地'
@staticmethod
def type():
return '动漫'
class MingXing(EnumBase):
XiaoZhan = '肖战'
YangMi = '杨幂'
YangYang = '杨洋'
YangYin = '杨颖'
YangZi = '杨紫'
YangYan = '唐嫣'
LiuShiShi = '刘诗诗'
WangYiBo = '王一博'
ZhaoLiYing = '赵丽颖'
ZhangYiXing = '张艺兴'
TFBOYS = 'TFBOYS'
DiLiReBa = '迪丽热巴'
@staticmethod
def type():
return '明星'
class YouXi(EnumBase):
LianMeng = '英雄联盟'
WangZhe = '王者荣耀'
MoShou = '魔兽世界'
ShouWang = '守望先锋'
ZhuJi = '主机游戏'
ShouYou = '手游世界'
ReMen = '热门网游'
DOTA = 'DOTA2'
@staticmethod
def type():
return '游戏'
class QiChe(EnumBase):
Bu = '布加迪'
Lan = '兰博基尼'
BenChi = '奔驰'
FaLaLi = '法拉利'
BaoMa = '宝马'
LuHu = '路虎'
FuTe = '福特'
BinLi = '宾利'
XueFuLan = '雪佛兰'
JeiBao = '捷豹'
HanMa = '悍马'
JEEP = 'JEEP'
MaShaLaDi = '玛莎拉蒂'
AoDi = '奥迪'
MINI = 'MINI'
BaoShiJei = '保时捷'
LaoSiLaiSi = '劳斯莱斯'
KeEr = '克尔维特'
@staticmethod
def type():
return '汽车'
class XiaoNiaoType(EnumBase):
_4K = {'name': '4K专区', 'cids': 36} # 4K专区
MeiNv = {'name': '美女模特', 'cids': 6, 'type': MeiNv.values()} # 美女模特
AiQing = {'name': '爱情', 'cids': 30, 'type': AiQing.values()} # 爱情
Fengjing = {'name': '风景', 'cids': 9, 'type': FengJing.values()} # 风景
XiaoQingXin = {'name': '小清新', 'cids': 15, 'type': XiaoQingXin.values()} # 小清新
DongMan = {'name': '动漫', 'cids': 26, 'type': DongMan.values()} # 动漫
MingXing = {'name': '明星', 'cids': 11, 'type': MingXing.values()} # 明星
MengChong = {'name': '萌宠', 'cids': 14, 'type': MengChong.values()} # 萌宠
Game = {'name': '游戏', 'cids': 5, 'type': YouXi.values()} # 游戏
QiChe = {'name': '汽车', 'cids': 12, 'type': QiChe.values()} # 汽车
XuanKu = {'name': '炫酷时尚', 'cids': 10} # 炫酷时尚
RiLi = {'name': '日历壁纸', 'cids': 29} # 日历壁纸
YingShi = {'name': '影视剧照', 'cids': 7} # 影视剧照
JeiRi = {'name': '节日美图', 'cids': 13} # 节日美图
JunShi = {'name': '军事天地', 'cids': 22} # 军事天地
TiYu = {'name': '劲爆体育', 'cids': 16} # 劲爆体育
BaBy = {'name': 'BABY秀', 'cids': 18} # BABY秀
WenZi = {'name': '文字控', 'cids': 35} # 文字控
@classmethod
def get_cids(cls, key):
for value in cls.values():
if value['name'] == key:
return value['cids']
class Search:
"""
搜索
"""
url = XiaoNiaoBaseUrl + '/search?content={content}&pageno={page}&count={count}'
headers = {'User-Agent': cfg.get(cfg.userAgent)}
@classmethod
@exceptionHandler([])
def send(cls, content: str = '原神', page: int = 1, *, count: int = 30):
url = cls.url.format(content=content, page=page, count=count)
response = requests.get(url, headers=cls.headers)
return response.json()['data']['list']
class GetListByHotTag:
"""
按热门标签获取列表
"""
url = XiaoNiaoBaseUrl + '/GetListByHotTag?tag={tag}&pageno={page}&count={count}'
headers = {'User-Agent': cfg.get(cfg.userAgent)}
@classmethod
@exceptionHandler([])
def send(cls, tag: Union[str, EnumBase], page: int = 1, *, count: int = 30):
if isinstance(tag, EnumBase):
tag = tag.value
url = cls.url.format(tag=tag, page=page, count=count)
response = requests.get(url, headers=cls.headers)
return response.json()['data']['list']
class GetListByCategory:
"""
按类别获取列表
"""
url = XiaoNiaoBaseUrl + '/GetListByCategory?pageno={page}&count={count}&cids={cids}'
headers = {'User-Agent': cfg.get(cfg.userAgent)}
@classmethod
@exceptionHandler([])
def send(cls, page: int = 1, cids: int = 36, *, count: int = 30):
url = cls.url.format(page=page, cids=cids, count=count)
response = requests.get(url, headers=cls.headers)
return response.json()['data']['list']
class NewestList:
"""
最新的列表
"""
url = 'https://shcdn-wp.shanhutech.cn/intf/newestList?pageno={page}&count={count}'
headers = {'User-Agent': cfg.get(cfg.userAgent)}
@classmethod
@exceptionHandler([])
def send(cls, page: int = 1, *, count: int = 30):
url = cls.url.format(page=page, count=count)
response = requests.get(url, headers=cls.headers)
return response.json()