Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Lewa = &Spider{ Name: "乐蛙登录测试", Description: "乐蛙登录测试 [Auto Page] [http://accounts.lewaos.com]", EnableCookie: true, RuleTree: &RuleTree{ Root: func(ctx *Context) { ctx.AddQueue(&request.Request{Url: "http://accounts.lewaos.com/", Rule: "登录页"}) }, Trunk: map[string]*Rule{ "登录页": { ParseFunc: func(ctx *Context) { NewForm( ctx, "登录后", "http://accounts.lewaos.com", ctx.GetDom().Find(".userlogin.lw-pl40"), ).Inputs(map[string]string{ "username": "", "password": "", }).Submit() }, }, "登录后": { ParseFunc: func(ctx *Context) { ctx.Output(map[string]interface{}{ "Body": ctx.GetText(), "Cookie": ctx.GetCookie(), }) ctx.AddQueue(&request.Request{ Url: "http://accounts.lewaos.com/member", Rule: "个人中心", Header: http.Header{"Referer": []string{ctx.GetUrl()}}, }) }, }, "个人中心": { ParseFunc: func(ctx *Context) { ctx.Output(map[string]interface{}{ "Body": ctx.GetText(), "Cookie": ctx.GetCookie(), }) }, }, }, }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.