Documentation
¶
Index ¶
- func CookiesToHeader(allCookies map[string][]*http.Cookie) string
- func CreateHttpClient(proxies string) (tlsClient.HttpClient, error)
- func IsNumeric(s string) bool
- func MakeRequest(client tlsClient.HttpClient, config RequestConfig) ([]byte, *http.Response, error)
- func RandomSleep(min, max int)
- func Sleep(seconds int)
- type CookieClient
- type HeaderPair
- type LogLevel
- type Logger
- type RequestConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateHttpClient ¶
func CreateHttpClient(proxies string) (tlsClient.HttpClient, error)
func IsNumeric ¶
IsNumeric checks if a string contains only numeric characters. Used to distinguish between numeric IDs and usernames.
Parameters:
- s: the string to check
Returns:
- bool: true if string contains only digits
Example:
IsNumeric("123456") // returns true IsNumeric("user123") // returns false IsNumeric("") // returns false
func MakeRequest ¶
func MakeRequest(client tlsClient.HttpClient, config RequestConfig) ([]byte, *http.Response, error)
MakeRequest handles HTTP requests with proper header ordering and error handling
func RandomSleep ¶
func RandomSleep(min, max int)
RandomSleep sleeps for a random duration between min and max seconds
Types ¶
type CookieClient ¶
func NewCookieClient ¶
func NewCookieClient() *CookieClient
func (*CookieClient) AddCookies ¶
func (jar *CookieClient) AddCookies(cookies []http.Cookie)
func (*CookieClient) CookiesToHeader ¶
func (jar *CookieClient) CookiesToHeader() string
CookiesToHeader this function converts cookies from the []cycletls.Cookie{} format to a header format that simply contains a string of all cookies in the name=value format;
func (*CookieClient) GetCookieValue ¶
func (jar *CookieClient) GetCookieValue(name string) (string, bool)
func (*CookieClient) SetCookieFromResponse ¶
func (jar *CookieClient) SetCookieFromResponse(resp *http.Response)
type HeaderPair ¶
HeaderPair represents a header key-value pair
type RequestConfig ¶
type RequestConfig struct { Method string URL string Body io.Reader Headers []HeaderPair }
RequestConfig contains all possible options for making a request
func DefaultConfig ¶
func DefaultConfig() RequestConfig
DefaultConfig returns common Twitter request headers and their order