免费的壁纸api

python 复制代码
# 联想壁纸
from enum import Enum

import requests


class LenovoTopHeadersTypePage(Enum):
    """
    头部页面类型
        wallpaper 精选
        wallpaperHot 热门
        wallpaperRank 排行
    """
    wallpaper = 'wallpaper'
    wallpaperHot = 'wallpaperHot'
    wallpaperRank = 'wallpaperRank'


class LenovoWallpaper:
    base_url = 'https://pc-store.lenovomm.cn'
    wallpaper_url = base_url + '/wallpapercontent/wallpaper'

    def __init__(self):
        self.headers = {
            'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36&PCStore',
            # 必须得用这个ua
            'token': 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJvcyI6IndpbjEwIiwiY2giOiI5LjAuMTMwMC4wMjAxIiwibXQiOiIxMC4wLjIyNjIxIiwib3NCaXQiOiI2NCIsInNuIjoiMjQ1Nzc5MTFiYjE0NzYzYzBlOWRmMjFkMzUyMzc5OTAzNzM3NjQyNDkxZWYyOThmYzI1NjRkZWY4NWM5MDc5MiIsImV4cCI6MTcxMzAwNDcwMiwidXVpZCI6IjdEN0E3RTVDLTVBQ0UtMTFFRS04REM3LUQ0N0UwMDM3M0YwMCIsIm1hYyI6Ijc0MTNlYTdlOGRiYyJ9.BjW0q5rGDps5aGyWPpU4hyUPS2_iJumajXrx7VrpP6E'
        }

    def get_token(self):
        data = {
            "channelInfo": {
                "businessChannel": "Nil"
            },
            "commonData": {
                "channel": "20005",
                "from": "indstore",
                "mac": "7413ea7e8dbc",
                "mt": "10.0.22621",
                "os": "6.1.50.12061",
                "osBit": "64",
                "pcmStoreVer": "9.0.1200.1220",
                "pcmVer": "6.1.50.12061",
                "preVersion": "",
                "sn": "123108Z0M768120852C",
                "uuid": "7D7A7E5C-5ACE-11EE-8DC7-D47E00373F00",
                "ver": "9.0.1330.201",
                "versionCode": "9.0.1330.201",
                "versionName": "9.0.1330.201"
            },
            "settingInfo": {
                "smbOptions": "1"
            }
        }
        url = self.base_url + '/sysconfigservice/indep/business_parameter'
        response = requests.post(url, headers=self.headers, json=data)
        token = response.json().get('data', {}).get('btoken', None)
        return token

    def banner(self, page_type: LenovoTopHeadersTypePage = LenovoTopHeadersTypePage.wallpaper):
        """
        精选、热门、排行
        顶部横幅内容
        :param page_type:
        :return:
        """
        url = self.wallpaper_url + '/banner/top_banner_content_v2'
        params = {'pageType': page_type.value}
        response = requests.get(url, params=params, headers=self.headers)
        return response

    def rank_more(self, rank_id: int = 2707):
        """
        排行
        :param rank_id:
        :return
        """
        url = self.wallpaper_url + '/rank_more'
        params = {
            'code': rank_id,
            'limit': 48,
            'skip': 48,
            'wallpaperId': ''
        }
        response = requests.get(url, params=params, headers=self.headers)
        return response

    def classes(self):
        """
        壁纸分类接口
        :return:
        """
        url = self.wallpaper_url + '/classes'
        response = requests.get(url, headers=self.headers)
        return response

    def group_content(self, page_type: LenovoTopHeadersTypePage = LenovoTopHeadersTypePage.wallpaper):
        """
        页面内容
        :param page_type:
        :return:
        """
        url = self.wallpaper_url + '/group_content'
        params = {'pageType': page_type.value}
        response = requests.get(url, params=params, headers=self.headers)
        return response

    def class_wallpaper_list(self, skip: int = 0, classId: int = -1, tagId: int = -1, priceId: int = 0):
        """
        根据分类接口获取壁纸信息
        :return:
        """
        # params = {
        #     'skip': str(skip),  # 页码
        #     'limit': str(54),  # 每页?条
        #     'count': str(76873),
        #     'tagId': tagId,
        #     'colorId': str(-1),
        #     'classId': classId,
        #     'refresh': 'true',
        #     'priceId': priceId  # 资费  	 -1 全部, 0 免费, 1 付费
        # }

        url = "https://pc-store.lenovomm.cn/wallpapercontent/wallpaper/class_wallpaper_list"
        params = {
            "skip": f"{skip}",
            "limit": "54",
            "count": "76873",
            "tagId": f"{tagId}",
            "colorId": "-1",
            "classId": f"{classId}",
            "refresh": "true",
            "priceId": f"{priceId}"
        }
        response = requests.get(url, headers=self.headers, params=params)
        return response
相关推荐
xlsw_几秒前
java全栈day21--Web后端实战之利用Mybaits查询数据
java·开发语言
Murphy202315 分钟前
.net4.0 调用API(form-data)上传文件及传参
开发语言·c#·api·httpwebrequest·form-data·uploadfile·multipart/form-
GZ同学17 分钟前
Arcgis中python工具箱制造要点及统计要素图层字段信息工具分享
python·arcgis
我曾经是个程序员26 分钟前
C#Directory类文件夹基本操作大全
服务器·开发语言·c#
白云~️27 分钟前
uniappX 移动端单行/多行文字隐藏显示省略号
开发语言·前端·javascript
编码浪子33 分钟前
构建一个rust生产应用读书笔记7-确认邮件2
开发语言·后端·rust
天之涯上上1 小时前
JAVA开发 在 Spring Boot 中集成 Swagger
java·开发语言·spring boot
2402_857583491 小时前
“协同过滤技术实战”:网上书城系统的设计与实现
java·开发语言·vue.js·科技·mfc
北京_宏哥1 小时前
python接口自动化(四十二)- 项目架构设计之大结局(超详解)
python·架构·前端框架
爱学习的白杨树1 小时前
MyBatis的一级、二级缓存
java·开发语言·spring