Documentation ¶
Index ¶
- type BodyData
- type CatalogJSON
- type FileData
- type GetData
- type Request
- type Response
- type SuperAgent
- func (p *SuperAgent) Board(board string) *SuperAgent
- func (p *SuperAgent) Comment(comment string) *SuperAgent
- func (p *SuperAgent) Do(passcode string) (string, error)
- func (p *SuperAgent) File(file ...interface{}) *SuperAgent
- func (p *SuperAgent) Mail(mail string) *SuperAgent
- func (p *SuperAgent) MakeRequest() (*http.Request, error)
- func (p *SuperAgent) Name(name string) *SuperAgent
- func (p *SuperAgent) PasscodeAuth(passcode string) bool
- func (p *SuperAgent) Subject(subject string) *SuperAgent
- func (p *SuperAgent) Thread(thread string) *SuperAgent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BodyData ¶
Here we store minimal base fields like board, thread, name, email, subject and comment to make a post
type CatalogJSON ¶
type CatalogJSON struct { Board string `json:"board"` BoardInfo string `json:"BoardInfo"` Threads []struct { Comment string `json:"comment"` Lasthit int `json:"lasthit"` Num string `json:"num"` PostsCount int `json:"posts_count"` Score json.Number `json:"score"` Subject string `json:"subject"` Timestamp int `json:"timestamp"` Views int `json:"views"` } `json:"threads"` }
type SuperAgent ¶
type SuperAgent struct { Passcode string Cookies []*http.Cookie BodyData map[string]string FileData []FileData Client *http.Client Errors []error }
A SuperAgent is an object storing all required request data
func (*SuperAgent) Board ¶
func (p *SuperAgent) Board(board string) *SuperAgent
Used to set board field. Required.
func (*SuperAgent) Comment ¶
func (p *SuperAgent) Comment(comment string) *SuperAgent
Used to set comment field, this is where your post text goes
func (*SuperAgent) Do ¶
func (p *SuperAgent) Do(passcode string) (string, error)
Do() is the most important function that you need to call when ending the chain. The request won't proceed without calling it.
func (*SuperAgent) File ¶
func (p *SuperAgent) File(file ...interface{}) *SuperAgent
File() accepts string as path to a local file or remote HTTP URL. Example: File("1.png") or File("https://i.imgur.com/1.png") or File("1.jpg", "https://i.imgur.com/1.png")
func (*SuperAgent) Mail ¶
func (p *SuperAgent) Mail(mail string) *SuperAgent
Used to set email field
func (*SuperAgent) MakeRequest ¶
func (p *SuperAgent) MakeRequest() (*http.Request, error)
func (*SuperAgent) PasscodeAuth ¶
func (p *SuperAgent) PasscodeAuth(passcode string) bool
Used to authorize passcode into usercode to use it later with HTTP cookie to bypass CAPTCHA. Details https://2ch.hk/2ch
func (*SuperAgent) Subject ¶
func (p *SuperAgent) Subject(subject string) *SuperAgent
Used to set subject field
func (*SuperAgent) Thread ¶
func (p *SuperAgent) Thread(thread string) *SuperAgent
Used to set thread number field. Required. Leave it empty or set 0 to create new thread