sail

package
v0.0.0-...-5ddd87b Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultHeader = map[string]string{
	"Accept":     "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8",
	"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/47.0.2526.73 Chrome/47.0.2526.73 Safari/537.36",
}

Functions

func GetCookie

func GetCookie(url string) (cj *cookiejar.Jar, err error)

get cookie from main page

func GetRequest

func GetRequest(url string, header map[string]string) (string, error)

raw header

func GetRequestByCookie

func GetRequestByCookie(url string, cj *cookiejar.Jar) (string, error)

func Parse

func Parse(resp string, rudder *Rudder) (pageNo int, pageCount int, users map[string][]string, err error)

old parse method

func ParseJson

func ParseJson(resp string, out *map[string]interface{}) (err error)

func ValueToString

func ValueToString(in *map[string]interface{}) (out *map[string]string, err error)

Types

type Rudder

type Rudder struct {

	//pattern to get number of related users
	CountPatterns []string
	//pattern to get current page number
	PageNoPatterns []string
	//pattern to get page size
	//PageSizePattern string
	//pattern to get number of pages
	PageCountPatterns []string

	//pattern to get user id
	IDsPatterns []string
	//pattern to get user name
	NamesPatterns []string
	//pattern to get followers count
	FollowersCountPatterns []string
	//other patterns to get user info
	OtherPatterns     []string
	OtherListPatterns []string
}

since regexp does not support lookbehind/ahead, use multi patterns instead

type Seed

type Seed struct {
	FixedFormater string
	ID            string
	PageNo        int
	PageSize      int
	Interval      int //interval between each request
}

func (*Seed) GetUrl

func (s *Seed) GetUrl() (url string)

type SharedCookie

type SharedCookie struct {
	// contains filtered or unexported fields
}

func NewSharedCookie

func NewSharedCookie(url string) (sck *SharedCookie)

func (*SharedCookie) GetCookieUrl

func (ck *SharedCookie) GetCookieUrl() (url string, err error)

func (*SharedCookie) GetSharedCookie

func (ck *SharedCookie) GetSharedCookie() (cj *cookiejar.Jar, err error)

func (*SharedCookie) UpdateSharedCookie

func (ck *SharedCookie) UpdateSharedCookie() (cj *cookiejar.Jar, err error)

Jump to

Keyboard shortcuts

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