utils

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2025 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.0.0"
)

常用的User-Agent

Variables

This section is empty.

Functions

func AutoVerification

func AutoVerification(img image.Image, outputShape ort.Shape) string

验证码识别

func Base64ToImage added in v1.5.0

func Base64ToImage(base64Str string) (image.Image, error)

base64转图片

func CalculateJPEGMD5 added in v1.6.5

func CalculateJPEGMD5(img image.Image, quality int) (string, error)

使用 JPEG 编码图像后计算其 MD5

func ConvertToGray

func ConvertToGray(img image.Image) *image.Gray

ConvertToGray 将彩色图像转换为灰度图

func CookiesAddNoRepetition added in v1.8.0

func CookiesAddNoRepetition(addTarget *[]*http.Cookie, oldTarget []*http.Cookie)

添加Cookies,并且是无重复添加,意思就是添加到目标Cookies里面时会检测是否有重复Key的Cookie,如果有则直接替换Cookie值

func CookiesFiltration added in v1.8.1

func CookiesFiltration(keys []string, cookies []*http.Cookie) []*http.Cookie

过滤并获取指定Cookies并返回

func CqieEncrypt

func CqieEncrypt(str string) []byte

加密函数:如果输入的 o 有效,则使用 SM4 加密

func DeleteFile

func DeleteFile(path string)

func GetFaceBase64 added in v1.5.0

func GetFaceBase64() (image.Image, error)

过人脸数据

func ImageRGBDisturb added in v1.4.7

func ImageRGBDisturb(img image.Image) image.Image

像素干扰

func ImageToGrayFloatArray

func ImageToGrayFloatArray(img image.Image) []float32

图片转一维数组数据 ImageToGrayFloatArray 将灰度图像转换为一维浮点数组,范围为 [0.0, 1.0]

func IsBadImg added in v1.3.0

func IsBadImg(imgFile string) bool

检测图片是否损坏,损坏为true,没损坏为false

func LoadImage

func LoadImage(filePath string) (image.Image, error)

LoadImage 读取指定路径的图片并返回 image.Image 对象。 支持 JPEG 和 PNG 格式的图片。

func ParseWorkInform added in v1.4.2

func ParseWorkInform(doc *goquery.Document) (map[string]interface{}, error)

用于截取作业信息中用于回答回答题目的关键参数

func PathExistForCreate

func PathExistForCreate(path string)

检测目录是否存在,不存在就创建

func PathExists

func PathExists(path string) (bool, error)

检测文件夹或文件是否存在

func ReadImg

func ReadImg(imgFile string) (image.Image, error)

从文件读取imgage

func ResizeImage

func ResizeImage(img image.Image, width, height uint) *image.RGBA

ResizeImage 将图片缩放到指定宽度和高度并返回 RGB 图像

func RunFuncName added in v1.7.4

func RunFuncName() string

RunFuncName 获取正在运行的函数名

func SaveImageAsJPEG added in v1.6.5

func SaveImageAsJPEG(img image.Image, path string) error

saveImageAsJPEG 将图像保存为 JPEG 到指定路径

func TokenHex added in v1.8.1

func TokenHex(len int) string

用于生成IMEI

func YatoriCoreInit

func YatoriCoreInit()

Types

type QuestionSet added in v1.1.2

type QuestionSet struct {
	ID   string // 可以根据需要添加其他字段,例如题目ID
	HTML string
}

QuestionSet 结构体用于存储每个 div.Py-mian1 的原始 HTML 内容

func ParseQuestionSets added in v1.1.2

func ParseQuestionSets(doc *goquery.Document) []QuestionSet

ParseQuestionSets 函数用于提取所有 div.Py-mian1 节点的原始 HTML 内容

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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