Documentation
¶
Index ¶
- Constants
- func Base64ToImage(base64Str string) (image.Image, error)
- func CalculateJPEGMD5(img image.Image, quality int) (string, error)
- func ConvertToGray(img image.Image) *image.Gray
- func CookiesAddNoRepetition(addTarget *[]*http.Cookie, oldTarget []*http.Cookie)
- func CookiesFiltration(keys []string, cookies []*http.Cookie) []*http.Cookie
- func CqieEncrypt(str string) []byte
- func DeleteFile(path string)
- func ExtractAssets(dir string, names ...string) error
- func GetFaceBase64() (image.Image, error)
- func GetImageShape(img image.Image) (height, width, channels int)
- func HumanDelay(min, max time.Duration)
- func ImageRGBDisturb(img image.Image) image.Image
- func ImageRGBDisturbAdjust(img image.Image, strength int) image.Image
- func ImageToGrayFloatArray(img image.Image) []float32
- func IsBadImg(imgFile string) bool
- func LoadImage(filePath string) (image.Image, error)
- func ParseWorkInform(doc *goquery.Document) (map[string]interface{}, error)
- func PathExistForCreate(path string)
- func PathExists(path string) (bool, error)
- func ProcessImageDisturb(img image.Image) image.Image
- func ReadFileAsString(path string) (string, error)
- func ReadImg(imgFile string) (image.Image, error)
- func ResizeImage(img image.Image, width, height uint) *image.RGBA
- func RunFuncName() string
- func SaveImageAsJPEG(img image.Image, path string) error
- func SaveTextToFile(path, content string, appendMode bool, fileMode os.FileMode) error
- func TokenHex(len int) string
- func TurnCookiesFromString(cookieStr string) []*http.Cookie
- func YatoriCoreInit()
- type QuestionSet
Constants ¶
const (
DefaultUserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36 Edg/143.0.0.0"
)
常用的User-Agent
Variables ¶
This section is empty.
Functions ¶
func CalculateJPEGMD5 ¶
使用 JPEG 编码图像后计算其 MD5
func CookiesAddNoRepetition ¶
添加Cookies,并且是无重复添加,意思就是添加到目标Cookies里面时会检测是否有重复Key的Cookie,如果有则直接替换Cookie值
func CookiesFiltration ¶
过滤并获取指定Cookies并返回
func DeleteFile ¶
func DeleteFile(path string)
func ExtractAssets ¶
ExtractAssets writes the named embedded legacy assets to dir.
Library callers can use this to materialize only the helper binaries a platform needs instead of calling YatoriCoreInit, which extracts the complete legacy asset bundle into the process working directory.
func GetImageShape ¶
func HumanDelay ¶
HumanDelay 拟人化随机等待 [min, max](含两端)。 用于在连续接口调用之间插入不固定的间隔,避免固定/过快的请求节奏被识别为非人类特征。
func ImageRGBDisturbAdjust ¶
ImageRGBDisturb 对图像像素颜色进行随机扰动,强度范围 [0,255]
func ImageToGrayFloatArray ¶
图片转一维数组数据 ImageToGrayFloatArray 将灰度图像转换为一维浮点数组,范围为 [0.0, 1.0]
func ParseWorkInform ¶
用于截取作业信息中用于回答回答题目的关键参数
func ProcessImageDisturb ¶
ProcessImageDisturb 对输入图像进行轻度像素扰动并返回新的 image.Image
func ReadFileAsString ¶
ReadFileAsString 读取文本文件并以 string 返回
func ResizeImage ¶
ResizeImage 将图片缩放到指定宽度和高度并返回 RGB 图像
func SaveImageAsJPEG ¶
saveImageAsJPEG 将图像保存为 JPEG 到指定路径
func SaveTextToFile ¶
SaveTextToFile 将 content 写入到 path 指定的文件。 如果 appendMode 为 true,则以追加模式写入(文件不存在会创建); 否则以覆盖模式写入(会创建或截断已有文件)。 fileMode 指定创建文件时的权限(如 0644)。
func TurnCookiesFromString ¶
TurnCookiesFromString 将一整串 cookie 字符串解析成*http.Cookie数组并返回
func YatoriCoreInit ¶
func YatoriCoreInit()
Types ¶
type QuestionSet ¶
QuestionSet 结构体用于存储每个 div.Py-mian1 的原始 HTML 内容
func ParseQuestionSets ¶
func ParseQuestionSets(doc *goquery.Document) []QuestionSet
ParseQuestionSets 函数用于提取所有 div.Py-mian1 节点的原始 HTML 内容