Documentation ¶
Index ¶
- Constants
- Variables
- func GetAndroidId() string
- func GetImei(n int, tac string) string
- func GetRandomImei(n int, filename string) string
- func GetSortParam(params map[string]string) string
- func GetTimeFromString(ds string) (time.Time, error)
- func GetTimestamp() int64
- func InterfaceToStr(i interface{}) string
- func LuhnResidue(digits string) int
- func RandomChoice(choices []string) string
- func RandomChoiceAny(choices []interface{}) interface{}
- func ReverseStr(s string) string
- func Str2DEC(s string) (num int)
- func Sum(digits []int) int
- type Config
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 ¶
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 GetSortParam ¶
func InterfaceToStr ¶
func InterfaceToStr(i interface{}) string
func LuhnResidue ¶
def luhn_residue(digits):
return sum(sum(divmod(int(d) * (1 + i % 2), 10)) for i, d in enumerate(digits[::-1])) % 10
func RandomChoiceAny ¶
func RandomChoiceAny(choices []interface{}) interface{}
func ReverseStr ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.