HupuApp

package module
v0.0.0-...-562e60d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2023 License: MIT Imports: 11 Imported by: 0

README

虎扑篮球命令行版

Duncan

灵感来自另一位JR, 本来想fork他的工程继续改的,但是发现自己都没用到他的代码。所以就自己新建一个项目了.

目前大部分功能支持python3.x, python2.x, 部分功能python2.x的适配还在加油中...

window的适配也在努力中...

go 版本的架构

  • cmd 入口
  • gohupu
    • api
      • live.go 直播接口
      • base.go 接口基础
    • message
      • ws.go websocket消息
      • http.go http消息
    • live
      • client.go 直播客户端
    • menu
      • base.go 基础
      • live.go 直播菜单
    • logger 日志
  • constant.go 常量,设置等
  • utils.go 公用方法
测试环境
  • go version go1.16.4 windows/amd64

安装

release页面中选择符合自己系统版本的下载, 解压缩后进入文件夹直接执行./hupu

使用指南

Usage: Hupu <command>

A command line tool for Hupu.

Commands:
  live            比赛直播.
    <gameType>    比赛类型(nba/cba).

  news            新闻、帖子.
    <region>      领域(nba/cba/湿乎乎/步行街).

Flags:
  -h, --help     Show context-sensitive help.
      --debug    Enable debug mode.

Run "Hupu <command> --help" for more information on a command.

方向键上下控制选项,回车选择,ctrl+c中途退出。

虎扑直播

Hupu live nba

hupu_live

hupu_live_contrast

虎扑新闻

Hupu news 步行街

hupu_news

To-do list

  • go版本其他功能(新闻,数据等)
    • 新闻
    • 数据

Documentation

Index

Constants

View Source
const (
	DefaultTac  = "tac.csv"
	API_VERSION = "7.5.59"
	HUPU_SALT   = "HUPU_SALT_AKJfoiwer394Jeiow4u309"
	// 接口
	API_STATUS_INIT      = "https://games.mobileapi.hupu.com/1/" + API_VERSION + "/status/init"
	API_GET_GAMES        = "https://games.mobileapi.hupu.com/1/" + API_VERSION + "/%s/getGames"
	API_GET_PLAY_BY_PLAY = "https://games.mobileapi.hupu.com/1/" + API_VERSION + "/room/getPlaybyplay"
	// 直播接口
	API_SCHEDULE_LIST                = "https://games.mobileapi.hupu.com/1/" + API_VERSION + "/basketballapi/scheduleList"
	API_SINGLE_MATCH                 = "https://games.mobileapi.hupu.com/1/" + API_VERSION + "/basketballapi/singleMatch"
	API_LIVE_QUERY_LIVE_ACTIVITY_KEY = "https://live-api.liangle.com/1/" + API_VERSION + "/live/queryLiveActivityKey"
	API_LIVE_QUERY_LIVE_TEXT_LIST    = "https://live-api.liangle.com/1/" + API_VERSION + "/live/queryLiveTextList"
	// 一些设置
	LIVE_HEART_BEAT_PERIOD = 5 // 直播心跳间隔时间
	LOG_FILE               = "hupu.log"
)

Variables

View Source
var (
	ANDROID_USER_AGENT = []string{
		"Mozilla/5.0 (Android 5.1.1; Tablet; rv:48.0) Gecko/48.0 Firefox/48.0",
		"Mozilla/5.0 (Linux; Android 4.4.2; Phoenix 2 Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2768.59 Mobile Safari/537.36",
		"Mozilla/5.0 (Android 4.4.4; Mobile; rv:46.0) Gecko/46.0 Firefox/46.0",
		"Mozilla/5.0 (Linux; Android 6.0; 7045Y Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2755.4 Mobile Safari/537.36",
	}
	TAC_LIST = []string{
		"35651900", "35666503", "91054200", "35537803", "44831527", "86489400", "35084240", "13004008", "35103090", "35332802",
	}
)

Functions

func GetAndroidId

func GetAndroidId() string

func GetImei

func GetImei(n int, tac string) string

IMEI就是移动设备国际身份码,我们知道正常的手机串码IMEI码是15位数字,

由TAC(6位,型号核准号码)、FAC(2位,最后装配号)、SNR(6位,厂商自行分配的串号)和SP(1位,校验位)。
tac数据库: https://www.kaggle.com/sedthh/typeallocationtable/data

part = ”.join(str(random.randrange(0, 9)) for _ in range(N - 1)) if tac:

part = tac + part[len(tac):]

res = luhn_residue('{}{}'.format(part, 0)) return '{}{}'.format(part, -res % 10)

func GetRandomImei

func GetRandomImei(n int, filename string) string

func GetSortParam

func GetSortParam(params map[string]string) string

func GetTimeFromString

func GetTimeFromString(ds string) (time.Time, error)

func GetTimestamp

func GetTimestamp() int64

获取当前时间的millsecond

func InterfaceToStr

func InterfaceToStr(i interface{}) string

func LuhnResidue

func LuhnResidue(digits string) int

def luhn_residue(digits):

return sum(sum(divmod(int(d) * (1 + i % 2), 10)) for i, d in enumerate(digits[::-1])) % 10

func RandomChoice

func RandomChoice(choices []string) string

随机选择

func RandomChoiceAny

func RandomChoiceAny(choices []interface{}) interface{}

func ReverseStr

func ReverseStr(s string) string

func Str2DEC

func Str2DEC(s string) (num int)

func Sum

func Sum(digits []int) int

Types

type Config

type Config struct {
	// 接口设置
	API_VERSION            string `yml:"API_VERSION"`
	HUPU_SALT              string `yml:"HUPU_SALT"`
	LIVE_HEART_BEAT_PERIOD int    `yml:"LIVE_HEART_BEAT_PERIOD"`
	// 基础设置
	LOG_FILE int `yml:"LOG_FILE"`
}

Directories

Path Synopsis
gohupu
api

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL