免费的壁纸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
相关推荐
互联网杂货铺15 分钟前
基于Selenium+Python的web自动化测试框架(附框架源码+项目实战)
自动化测试·软件测试·python·selenium·测试工具·单元测试·测试用例
myheartgo-on38 分钟前
PySpark——Python与大数据
大数据·python·信息可视化
杨荧44 分钟前
【JAVA毕业设计】基于Vue和SpringBoot的宠物咖啡馆平台
java·开发语言·jvm·vue.js·spring boot·spring cloud·开源
monkey_meng1 小时前
【Rust中的项目管理】
开发语言·rust·源代码管理
喜欢打篮球的普通人1 小时前
rust高级特征
开发语言·后端·rust
weixin_478689761 小时前
【回溯法】——组合总数
数据结构·python·算法
天天要nx1 小时前
D68【python 接口自动化学习】- python基础之数据库
数据库·python
山山而川 潺潺如镜1 小时前
杰控通过 OPCproxy 获取数据发送到服务器
python
ModelBulider1 小时前
十三、注解配置SpringMVC
java·开发语言·数据库·sql·mysql
V搜xhliang02461 小时前
基于深度学习的地物类型的提取
开发语言·人工智能·python·深度学习·神经网络·学习·conda