Total Pageviews

Monday, 2 May 2022

HorseHunter.py


Don't like Python, or think the executables are too heavy? Try out new implementations in Go with smaller size and runs faster! forewing/horse-hunter

注:本软件仅限用于自卫反击,向网络暴力说不!

build discord

效果

剪贴板内每 0.1s 刷新一条金句,让你在骂战中不被欺凌

点击如下预览链接即意味着您已同意如下内容: 预览内容包含暴力、血腥、人身攻击内容,但不针对包括您在内的任何个人、群体、组织。 心理承受能力不足请不要点击浏览,若执意浏览,本项目组成员对造成的心理创伤不负任何责任

(预览链接)

依赖

  1. Python >= 3.6

  2. pyperclip

  3. PyQt5 (GUI version only)

  4. Flask (API version only)

pip install -r requirements-{VERSION}.txt

GUI 版本

  1. 前往 Release 下载最新程序 (HorseHunterGUI.exe)

  2. 运行

gui

更改设置后需要 Stop 再 Start 以应用更改

快捷使用

  1. 运行脚本
python HorseHunter.py
  1. 打开聊天框

Ctrl+V, Enter, Ctrl+V, Enter, Ctrl+V, Enter...

进阶使用

usage: HorseHunter.py [-h] [--target {female,male,mix}]
                      [--level {max,min,mix}] [--interval INTERVAL]

自动向剪贴板刷新金句,让你不再饱受欺凌

optional arguments:
  -h, --help            show this help message and exit
  --target {female,male,mix}, -t {female,male,mix}
                        设置辱骂对象, female=令堂, male=令尊, mix=混合. 默认 female
  --level {max,min,mix}, -l {max,min,mix}
                        设置辱骂等级, max=火力全开, min=口吐芬芳, mix=混合. 默认 max
  --interval INTERVAL, -i INTERVAL
                        设置刷新间隔(s). 默认 0.1

打包二进制文件

依赖 pyinstaller

  1. GUI
pyinstaller -F --add-data "resources-max.txt;." --add-data "resources-min.txt;." --noconsole HorseHunterGUI.py
  1. CLI
pyinstaller -F --add-data "resources-max.txt;." --add-data "resources-min.txt;." HorseHunter.py

将软件打包至 dist/HorseHunter.exe,使用方法与脚本形式相同。

API

提供 Flask API 于 HorseHunterAPI.py 中。

可通过

$ FLASK_APP=HorseHunterAPI.py flask run

python HorseHunterAPI.py # Bind 127.0.0.1:6675

或其他途径运行,详细配置请参考 Flask Documentation

URL方法参数返回值
/apiGET[level={max, min, mix}][target={female, male, mix}] 若参数空缺或不合法,分别填补默认值 level=maxtarget=female参数所指定的金句范围内随机抽取一条字符串

致谢

金句资源(resources-*.txt)、性别替换(replaceF2M.py)内容来源:直播点吧


from https://github.com/forewing/HorseHunter.py

-----


Horse Hunter (Go Implementation)

PkgGoDev

Build script

$ go run ./build -h
Usage of ./build:
  -cli
        build CLI
  -gui
        build GUI
  -zip
        compress output

CLI

On Linux, you need libx11-dev installed.

# Build
go build ./cmd/horse-hunter

# Run
$ horse-hunter -h
Usage of ./horse-hunter:
  -interval duration
        clipboard update interval (default 200ms)
  -level string
        insult level, [max | min | mix] (default "max")
  -target string
        insult target, [female | male | mix] (default "female")

GUI

showcase

Simple executable

go build ./cmd/horse-hunter-gui

Package for distribution

  1. Windows
go build -trimpath -ldflags "-s -w -H=windowsgui" -o HorseHunter.exe ./cmd/horse-hunter-gui
  1. macOS
# Build single executable. If you want a MacOS app, use builtin script
go build -trimpath -ldflags "-s -w" ./cmd/horse-hunter-gui
  1. Linux
# Install dependencies
sudo apt install xorg-dev -y

# Build binary
go build -trimpath -ldflags "-s -w" -o HorseHunter ./cmd/horse-hunter-gui
from https://github.com/forewing/horse-hunter

No comments:

Post a Comment