Documentation ¶
Index ¶
- Constants
- Variables
- type Param
- func (self *Param) GetConnTimeout() time.Duration
- func (self *Param) GetDialTimeout() time.Duration
- func (self *Param) GetHeader() http.Header
- func (self *Param) GetMethod() string
- func (self *Param) GetPostBody() string
- func (self *Param) GetRedirectTimes() int
- func (self *Param) GetRetryPause() time.Duration
- func (self *Param) GetTryTimes() int
- func (self *Param) GetUrl() string
- func (self *Param) GetusePhantomJS() bool
- type Phantom
- func (self *Phantom) CreatJsFile(jsfile string)
- func (self *Phantom) DestroyJsFile(filename string)
- func (self *Phantom) Download(req Request) (resp *http.Response, err error)
- func (self *Phantom) Exec(js string, args ...string) (stdout io.ReadCloser, err error)
- func (self *Phantom) Exist(filename string) bool
- func (self *Phantom) Open(openArgs ...string) (stdout io.ReadCloser, err error)
- func (self *Phantom) SetPageEncode(pageEncode string)
- func (self *Phantom) SetPhantomjsPath(name string, filepath string)
- func (self *Phantom) SetProxy(proxy string)
- func (self *Phantom) SetProxyAuth(proxyAuth string)
- func (self *Phantom) SetProxyType(proxyType string)
- func (self *Phantom) SetUserAgent(userAgent string)
- type Phantomer
- type Request
- type WebrowseParam
Constants ¶
View Source
const DIY_JS_FILE_NAME = "diy_jsfile_to_phantom"
View Source
const GET_JS_FILE_NAME = "get_jsfile_to_phantom"
javascript temp file name
View Source
const POST_JS_FILE_NAME = "post_jsfile_to_phantom"
Variables ¶
View Source
var GOPATH = os.Getenv("GOPATH")
Functions ¶
This section is empty.
Types ¶
type Param ¶
type Param struct { Method string Url string Header http.Header PostBody string RedirectTimes int //request redirect times allow 重定向次数 DialTimeout time.Duration ConnTimeout time.Duration RetryPause time.Duration //if request failed,retry time TryTimes int //if request failed,retry times UsePhantomJS bool }
供外部调用 external interface
func (*Param) GetConnTimeout ¶
func (*Param) GetDialTimeout ¶
func (*Param) GetPostBody ¶
func (*Param) GetRedirectTimes ¶
func (*Param) GetRetryPause ¶
func (*Param) GetTryTimes ¶
func (*Param) GetusePhantomJS ¶
type Phantom ¶
type Phantom struct { WebrowseParam // contains filtered or unexported fields }
func (*Phantom) CreatJsFile ¶
创建js临时文件 creat temp javascript file
func (*Phantom) Open ¶
func (self *Phantom) Open(openArgs ...string) (stdout io.ReadCloser, err error)
open the url address
func (*Phantom) SetPageEncode ¶
set web page decode for example [utf-8|gbk]
func (*Phantom) SetPhantomjsPath ¶
动态修改执行文件的Phantomjs.exe路径 set the phantomjs exec file
func (*Phantom) SetProxyAuth ¶
SetProxyAuth for example username:password
func (*Phantom) SetProxyType ¶
SetProxyType for example [http|socks5|none]
func (*Phantom) SetUserAgent ¶
SetUserAgent for example [chrome,firefox,IE..]
type Phantomer ¶
type Phantomer interface { SetUserAgent(string) SetProxy(string) SetProxyType(string) SetProxyAuth(string) SetPhantomjsPath(string, string) Download(Request) (*http.Response, error) Exec(string, ...string) (io.ReadCloser, error) }
func NewPhantom ¶
func NewPhantom() Phantomer
type Request ¶
type Request interface { GetMethod() string GetUrl() string GetHeader() http.Header GetPostBody() string GetRedirectTimes() int GetDialTimeout() time.Duration GetConnTimeout() time.Duration GetRetryPause() time.Duration GetTryTimes() int GetusePhantomJS() bool }
供内部调用 interior interface
type WebrowseParam ¶
type WebrowseParam struct {
// contains filtered or unexported fields
}
web browse param
Click to show internal directories.
Click to hide internal directories.