Convert Figma logo to code with AI

MetaCubeX logomihomo

A simple Python Pydantic model for Honkai: Star Rail parsed data from the Mihomo API.

15,255
2,533
15,255
356

Top Related Projects

16,571

A Clash Client For OpenWrt

4,027

Yet Another Clash Dashboard

Quick Overview

MetaCubeX/mihomo is a fork of the Clash core project, focusing on enhanced features and performance improvements for network proxy management. It aims to provide a more powerful and flexible solution for routing network traffic through various protocols and rules.

Pros

  • Enhanced feature set compared to the original Clash core
  • Active development and frequent updates
  • Improved performance and stability
  • Supports a wide range of proxy protocols and rule types

Cons

  • May have a steeper learning curve due to additional features
  • Potential compatibility issues with some Clash-based clients
  • Documentation might not be as comprehensive as the original Clash project
  • Increased complexity may lead to more challenging troubleshooting

Getting Started

To get started with MetaCubeX/mihomo:

  1. Download the latest release from the GitHub repository.
  2. Create a configuration file (e.g., config.yaml) with your proxy settings and rules.
  3. Run the mihomo binary with the configuration file:
./mihomo -f config.yaml
  1. Configure your system or applications to use the proxy address (default: 127.0.0.1:7890).

For more detailed setup instructions and configuration options, refer to the project's documentation on GitHub.

Competitor Comparisons

16,571

A Clash Client For OpenWrt

Pros of OpenClash

  • More comprehensive documentation and user guides
  • Wider range of supported platforms and devices
  • Active community support and frequent updates

Cons of OpenClash

  • Larger resource footprint and potentially higher system requirements
  • More complex configuration process for advanced features
  • May have slower performance in some scenarios due to additional features

Code Comparison

OpenClash:

config_path = "/etc/openclash/"
core_path = "/etc/openclash/core/"
core_type = "clash"

mihomo:

const (
    ConfigPath = "/etc/mihomo/"
    CorePath   = "/usr/bin/mihomo"
    CoreType   = "mihomo"
)

Key Differences

  • OpenClash is primarily designed for OpenWrt devices, while mihomo has a broader focus on various platforms
  • mihomo is a fork of the original Clash project, offering enhanced features and optimizations
  • OpenClash provides a more user-friendly interface for configuration and management
  • mihomo tends to have better performance in terms of speed and resource usage

Use Cases

OpenClash is ideal for:

  • Users with OpenWrt routers seeking a comprehensive proxy solution
  • Those who prefer a GUI-based configuration approach

mihomo is better suited for:

  • Users looking for a lightweight and high-performance proxy tool
  • Developers who want to integrate proxy functionality into their applications
4,027

Yet Another Clash Dashboard

Pros of yacd

  • Lightweight and focused dashboard for Clash
  • Easy to use and deploy as a static web application
  • Customizable themes and layouts

Cons of yacd

  • Limited to Clash functionality, less versatile than mihomo
  • May lack some advanced features present in mihomo
  • Smaller community and potentially slower development cycle

Code Comparison

yacd (React component):

const App = () => (
  <Provider store={store}>
    <ThemeProvider>
      <Router>
        <Layout>
          <Switch>
            <Route exact path="/" component={Overview} />
            <Route path="/proxies" component={Proxies} />
          </Switch>
        </Layout>
      </Router>
    </ThemeProvider>
  </Provider>
);

mihomo (Go code snippet):

func main() {
    cfg, err := config.Parse(os.Args[1:])
    if err != nil {
        log.Fatalln("Parse config error: ", err.Error())
    }

    if cfg.Profile != nil {
        defer profile.Start(cfg.Profile).Stop()
    }

    hub.Run(cfg)
}

Summary

yacd is a lightweight dashboard specifically designed for Clash, offering an easy-to-use interface with customizable themes. However, it may lack some advanced features and versatility compared to mihomo. mihomo, on the other hand, is a more comprehensive solution with a broader range of functionalities, but may be more complex to set up and use. The choice between the two depends on the specific needs of the user and their familiarity with Clash and related technologies.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

mihomo

A simple python pydantic model (type hint and autocompletion support) for Honkai: Star Rail parsed data from the Mihomo API.

API url: https://api.mihomo.me/sr_info_parsed/{UID}?lang={LANG}

Installation

pip install -U git+https://github.com/KT-Yeh/mihomo.git

Usage

Basic

There are two parsed data formats:

If you don't want to use client.get_icon_url to get the image url everytime, you can use client.fetch_user(800333171, replace_icon_name_with_url=True) to get the parsed data with asset urls.

Example

import asyncio

from mihomo import Language, MihomoAPI
from mihomo.models import StarrailInfoParsed
from mihomo.models.v1 import StarrailInfoParsedV1

client = MihomoAPI(language=Language.EN)


async def v1():
    data: StarrailInfoParsedV1 = await client.fetch_user_v1(800333171)

    print(f"Name: {data.player.name}")
    print(f"Level: {data.player.level}")
    print(f"Signature: {data.player.signature}")
    print(f"Achievements: {data.player_details.achievements}")
    print(f"Characters count: {data.player_details.characters}")
    print(f"Profile picture url: {client.get_icon_url(data.player.icon)}")
    for character in data.characters:
        print("-----------")
        print(f"Name: {character.name}")
        print(f"Rarity: {character.rarity}")
        print(f"Level: {character.level}")
        print(f"Avatar url: {client.get_icon_url(character.icon)}")
        print(f"Preview url: {client.get_icon_url(character.preview)}")
        print(f"Portrait url: {client.get_icon_url(character.portrait)}")


async def v2():
    data: StarrailInfoParsed = await client.fetch_user(800333171, replace_icon_name_with_url=True)

    print(f"Name: {data.player.name}")
    print(f"Level: {data.player.level}")
    print(f"Signature: {data.player.signature}")
    print(f"Profile picture url: {data.player.avatar.icon}")
    for character in data.characters:
        print("-----------")
        print(f"Name: {character.name}")
        print(f"Rarity: {character.rarity}")
        print(f"Portrait url: {character.portrait}")

asyncio.run(v1())
asyncio.run(v2())

Tools

from mihomo import tools

Remove Duplicate Character

    data = await client.fetch_user(800333171)
    data = tools.remove_duplicate_character(data)

Merge Character Data

    old_data = await client.fetch_user(800333171)

    # Change characters in game and wait for the API to refresh
    # ...

    new_data = await client.fetch_user(800333171)
    data = tools.merge_character_data(new_data, old_data)

Data Persistence

Take pickle and json as an example

import pickle
import zlib
from mihomo import MihomoAPI, Language, StarrailInfoParsed

client = MihomoAPI(language=Language.EN)
data = await client.fetch_user(800333171)

# Save
pickle_data = zlib.compress(pickle.dumps(data))
print(len(pickle_data))
json_data = data.json(by_alias=True, ensure_ascii=False)
print(len(json_data))

# Load
data_from_pickle = pickle.loads(zlib.decompress(pickle_data))
data_from_json = StarrailInfoParsed.parse_raw(json_data)
print(type(data_from_pickle))
print(type(data_from_json))