tokopedia_lib

package module
v1.1.16 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2023 License: MIT Imports: 18 Imported by: 0

README

tokopedia_lib

set dev mode

set DEV_MODE=true

tutorial naming auto submit

akun.txt email|pass|secretotp

ktp folder

  • naming foto ktp 01679765443368363.jpg

  • naming selfie ktp 01679765443368363_2.jpg

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BaseSessionPath = "/tokopedia_session_new/"

TODO: cookies dump afternya tidak ada

View Source
var ErrSellerLoginFailed = errors.New("seller login failed")
View Source
var ErrSessionNotFound = errors.New("session tidak ada")

Functions

func GetTotp

func GetTotp(secret string) (string, error)

Types

type Account

type Account struct {
	Username string
	Pass     string
	Secret   string
	Ktp      string
	Status   string
}

func GetVerificationAkun

func GetVerificationAkun(fname string) ([]*Account, func(), error)

type BrowserClosed

type BrowserClosed struct {
	sync.Mutex
	Data bool
}

type DriverAccount

type DriverAccount struct {
	Username string        `json:"username"`
	Password string        `json:"password"`
	Secret   string        `json:"secret"`
	DevMode  bool          `json:"-"`
	Proxy    string        `json:"-"`
	Session  DriverSession `json:"-"`
}

func NewDriverAccount

func NewDriverAccount(username string, password string, secret string) (*DriverAccount, error)

func (*DriverAccount) CreateApi

func (d *DriverAccount) CreateApi() (*api.TokopediaApi, func(), error)

func (*DriverAccount) CreateContext

func (d *DriverAccount) CreateContext(headless bool) (*DriverContext, func())

func (*DriverAccount) MitraLogin

func (driver *DriverAccount) MitraLogin(ctx context.Context) error

func (*DriverAccount) Run

func (d *DriverAccount) Run(headless bool, actionCallback func(dctx *DriverContext) error) error

func (*DriverAccount) SaveSession added in v1.0.1

func (d *DriverAccount) SaveSession(dctx *DriverContext) error

func (*DriverAccount) SellerLogin

func (d *DriverAccount) SellerLogin(dctx *DriverContext) error

type DriverContext

type DriverContext struct {
	sync.Mutex
	Logined bool
	Ctx     context.Context
}

type DriverSession

type DriverSession interface {
	SetCookieToDriver(ctx context.Context) error
	Load() error
	DeleteSession() error
	SaveSession() error
	Sync() error
	Update(cookies []*http.Cookie) error
	AddToHttpRequest(req *http.Request)
	UserAgent() string
	SaveFromDriver(cookies []*network.Cookie, ua string) error
	GetCookies() []*http.Cookie
}

type Session

type Session struct {
	sync.Mutex

	Cookies []*http.Cookie
	Ua      string
	// contains filtered or unexported fields
}

func NewSession

func NewSession(fname string) *Session

func (*Session) AddToHttpRequest

func (sess *Session) AddToHttpRequest(req *http.Request)

func (*Session) DeleteSession

func (sess *Session) DeleteSession() error

func (*Session) GetCookies

func (sess *Session) GetCookies() []*http.Cookie

func (*Session) Load

func (sess *Session) Load() error

func (*Session) SaveFromDriver

func (sess *Session) SaveFromDriver(cookies []*network.Cookie, ua string) error

func (*Session) SaveSession

func (sess *Session) SaveSession() error

func (*Session) SetCookieToDriver

func (sess *Session) SetCookieToDriver(ctx context.Context) error

func (*Session) Sync

func (sess *Session) Sync() error

func (*Session) Update

func (sess *Session) Update(cookies []*http.Cookie) error

func (*Session) UserAgent

func (sess *Session) UserAgent() string

Jump to

Keyboard shortcuts

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