Documentation ¶
Index ¶
- func CookiesToString(c Cookies) string
- func IsPrint(s string) bool
- func NewCookiesFromString(cookieStr string, cookieStruct Cookies) error
- func ReadSetCookiesCustom(h http.Header) []*http.Cookie
- func ToLower(s string) (lower string, ok bool)
- func UpdateFromResponse(cookieStruct Cookies, h http.Header)
- func UpdateMultipleValues(cookieStruct Cookies, names []string, values []string) error
- func UpdateValue(cookieStruct Cookies, name, val string)
- type Cookies
- type FacebookCookies
- type InstagramCookies
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CookiesToString ¶
func IsPrint ¶
IsPrint returns whether s is ASCII and printable according to https://tools.ietf.org/html/rfc20#section-4.2.
func NewCookiesFromString ¶
Example:
var cookies types.FacebookCookies err := types.NewCookiesFromString("...", &cookies)
func ReadSetCookiesCustom ¶
Custom implementation of std http lib implementation of parsing the Set-Cookie in response headers
Because their implementation can apparently says cookie values that start with " or contain \ are invalid (https://github.com/golang/go/blob/master/src/net/http/cookie.go#L415)
https://github.com/golang/go/blob/master/src/net/http/cookie.go#L60 readSetCookies parses all "Set-Cookie" values from the header h and returns the successfully parsed Cookies.
func UpdateFromResponse ¶
func UpdateMultipleValues ¶
Make sure the indexes for the names correspond with the correct value they should be set to
func UpdateValue ¶
Types ¶
type Cookies ¶
type Cookies interface { GetValue(name string) string GetViewports() (string, string) IsLoggedIn() bool ToJSON() ([]byte, error) }
func NewCookiesFromFile ¶
FROM JSON FILE.
func NewCookiesFromResponse ¶
type FacebookCookies ¶
type FacebookCookies struct { Datr string `cookie:"datr,omitempty" json:"datr,omitempty"` Sb string `cookie:"sb,omitempty" json:"sb,omitempty"` AccountId string `cookie:"c_user,omitempty" json:"c_user,omitempty"` Xs string `cookie:"xs,omitempty" json:"xs,omitempty"` Fr string `cookie:"fr,omitempty" json:"fr,omitempty"` Wd string `cookie:"wd,omitempty" json:"wd,omitempty"` Presence string `cookie:"presence,omitempty" json:"presence,omitempty"` }
func (*FacebookCookies) GetValue ¶
func (fb *FacebookCookies) GetValue(name string) string
func (*FacebookCookies) GetViewports ¶
func (fb *FacebookCookies) GetViewports() (string, string)
func (*FacebookCookies) IsLoggedIn ¶
func (fb *FacebookCookies) IsLoggedIn() bool
func (*FacebookCookies) ToJSON ¶
func (fb *FacebookCookies) ToJSON() ([]byte, error)
type InstagramCookies ¶
type InstagramCookies struct { SessionId string `cookie:"sessionid,omitempty" json:"SessionId,omitempty"` CsrfToken string `cookie:"csrftoken,omitempty" json:"CsrfToken,omitempty"` MachineId string `cookie:"mid,omitempty" json:"MachineId,omitempty"` IgDeviceId string `cookie:"ig_did,omitempty" json:"IgDeviceId,omitempty"` Rur string `cookie:"rur,omitempty" json:"Rur,omitempty"` UserId string `cookie:"ds_user_id,omitempty" json:"UserId,omitempty"` ShbId string `cookie:"shbid,omitempty" json:"ShbId,omitempty"` Shbts string `cookie:"shbts,omitempty" json:"Shbts,omitempty"` IgWWWClaim string `json:"IgWWWClaim,omitempty"` }
func (*InstagramCookies) GetValue ¶
func (ig *InstagramCookies) GetValue(name string) string
func (*InstagramCookies) GetViewports ¶
func (ig *InstagramCookies) GetViewports() (string, string)
func (*InstagramCookies) IsLoggedIn ¶
func (ig *InstagramCookies) IsLoggedIn() bool
func (*InstagramCookies) ToJSON ¶
func (ig *InstagramCookies) ToJSON() ([]byte, error)