⚔️ 英雄联盟手游助手

📋 功能说明
  • 查询英雄数据
  • 查看出装推荐
  • 战绩查询
💻 源代码
import requests
import json

class LOLMobileHelper:
    def __init__(self):
        self.api_base = 'https://api.riotgames.com/lol'
        self.api_key = 'your_api_key'
        
    def get_champions(self):
        """获取英雄列表"""
        url = f'{self.api_base}/platform/v3/champions'
        params = {'api_key': self.api_key}
        
        res = requests.get(url, params=params).json()
        return res.get('champions', [])
    
    def get_champion_detail(self, champ_id):
        """获取英雄详情"""
        url = f'{self.api_base}/champions/{champ_id}'
        params = {'api_key': self.api_key}
        
        res = requests.get(url, params=params).json()
        return res
    
    def get_match_history(self, summoner_id):
        """获取召唤师战绩"""
        url = f'{self.api_base}/v3/matchlists/by-account/{summoner_id}'
        params = {'api_key': self.api_key}
        
        res = requests.get(url, params=params).json()
        return res.get('matches', [])[:10]
    
    def get_match_detail(self, match_id):
        """获取比赛详情"""
        url = f'{self.api_base}/v3/matches/{match_id}'
        params = {'api_key': self.api_key}
        
        res = requests.get(url, params=params).json()
        return res

# 使用
helper = LOLMobileHelper()
champs = helper.get_champions()
print(f"共有 {len(champs)} 个英雄")
📦 运行环境
pip install requests
API说明
  • Riot Games API
  • 需申请API Key
  • 支持LOL手游