crawler

package
v0.0.0-...-9beddec Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2019 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// UA is Chrome's User-Agent
	UA = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.79 Safari/537.36"
	// AcceptType is Chrome's Accept-Type
	AcceptType = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8"
)

Variables

This section is empty.

Functions

func GenClientWithProxy

func GenClientWithProxy(proxy string) (*http.Client, error)

GenClientWithProxy 生成http.Client,并设置代理为proxy指定的代理服务器 proxy url支持http,https和socks5协议

func GetAuth

func GetAuth(user, passwd, proxy string) ([]*http.Cookie, error)

GetAuth 登录schannel并返回登陆成功后获得的cookies 这些cookies在后续的页面访问中需要使用

func GetCSRFToken

func GetCSRFToken(proxy string) (string, []*http.Cookie, error)

GetCSRFToken 返回本次回话所使用的CSRFToken

func GetInvoiceHTML

func GetInvoiceHTML(cookies []*http.Cookie, proxy string) (string, error)

GetInvoiceHTML 获取账单页面的HTML,包含未付款和已付款账单 未付款账单显示在最前列 现只支持获取第一页

func GetInvoiceInfoHTML

func GetInvoiceInfoHTML(invoice *parser.Invoice, cookies []*http.Cookie, proxy string) (string, error)

GetInvoiceInfoHTML 获取账单详情页面内容

func GetSSRInfoHTML

func GetSSRInfoHTML(service *parser.Service, cookies []*http.Cookie, proxy string) (string, error)

GetSSRInfoHTML 获取服务详细信息页面的HTML,包含使用情况和节点信息

func GetServiceHTML

func GetServiceHTML(cookies []*http.Cookie, proxy string) (string, error)

GetServiceHTML 获取所有已购买服务的状态信息,包括详细页面的地址

func SetRequestHeader

func SetRequestHeader(request *http.Request, cookies []*http.Cookie, referer, compress string)

SetRequestHeader 设置请求头信息 cookies为nil时将被忽略,referer和compress为“”时同样被忽略

Types

This section is empty.

Jump to

Keyboard shortcuts

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