免费的壁纸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
相关推荐
旧识君11 分钟前
移动端1px终极解决方案:Sass混合宏工程化实践
开发语言·前端·javascript·前端框架·less·sass·scss
郝YH是人间理想27 分钟前
OpenCV基础——傅里叶变换、角点检测
开发语言·图像处理·人工智能·python·opencv·计算机视觉
白白糖28 分钟前
二叉树 递归
python·算法·力扣
Tiger Z30 分钟前
R 语言科研绘图第 36 期 --- 饼状图-基础
开发语言·程序人生·r语言·贴图
揣晓丹40 分钟前
JAVA实战开源项目:校园失物招领系统(Vue+SpringBoot) 附源码
java·开发语言·vue.js·spring boot·开源
霍徵琅1 小时前
Groovy语言的物联网
开发语言·后端·golang
G皮T1 小时前
【Python Cookbook】字符串和文本(五):递归下降分析器
数据结构·python·正则表达式·字符串·编译原理·词法分析·语法解析
独好紫罗兰2 小时前
洛谷题单3-P1420 最长连号-python-流程图重构
开发语言·python·算法
kingmax542120082 小时前
深入解析:使用Python爬取Bilibili视频
开发语言·python·音视频
申雪菱2 小时前
Scheme语言的数据挖掘
开发语言·后端·golang