fbrip

package
v0.0.0-...-416eb90 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: BSD-2-Clause Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BasicFacebookUrl, _ = url.Parse("https://mbasic.facebook.com/")
View Source
var FacebookUrl, _ = url.Parse("https://www.facebook.com/")

Functions

func Do

func Do[A Action](user *UserRip, action A) bool

func GetReactionUrl

func GetReactionUrl(body io.Reader, reactId string) *url.URL

Declaring Url & Converting `reactId` to integer Looking for ActionBar where its patern path is: tbody > tr > td > a

func GetReactionsPickerUrl

func GetReactionsPickerUrl(body io.Reader) *url.URL

Looking for ActionBar where its patern path is: tbody > tr > td > a

func SearchBasicInfo

func SearchBasicInfo(body io.Reader) map[string]string

Searching path: 1*<div id="basic-info"> -> 6*<a> (<a> contains href which helps to determine what type of info attribute we are dealing)

func SearchParamsForUser

func SearchParamsForUser(body io.Reader, u *UserRip)

Finding user's parameters that are in input tags

func SetHeaders

func SetHeaders(request *http.Request, contentType string, paramsLength int)

Types

type Action

type Action interface {
	*React | *Publicate | *Comment | *Scrap
	// contains filtered or unexported methods
}

type ActionConfig

type ActionConfig struct {
	GetBasicInfo bool
	Reactions    []React
	Publications []Publicate
	Comments     []Comment
	Scraps       []Scrap
}

type Comment

type Comment struct {
	Content string
	Post    *Post
}

func NewComment

func NewComment(content string, postUrl string) *Comment

type Post

type Post struct {
	Url *url.URL
}

type Publicate

type Publicate struct {
	Url *url.URL
}

type React

type React struct {
	Id   string
	Post *Post
}

func NewReaction

func NewReaction(id string, postUrl string) *React

type RipPayload

type RipPayload struct {
	User    jsonUser    `json:"user"`
	Actions jsonActions `json:"actions"`
}

func ReadRip

func ReadRip(path string) (*RipPayload, error)

type Scrap

type Scrap struct {
	Url              *url.URL
	OutputFolderPath string
	OutputFilename   string
	TransformToBasic bool
}

func NewScrap

func NewScrap(pageRawUrl string, outputFolderPath string, outputFilename string, transformToBasic bool) *Scrap

type UserInfo

type UserInfo struct {
	Name     string
	Birthday string
	Gender   string
}

type UserRip

type UserRip struct {
	Email      string
	Password   string
	Parameters map[string]string
	Client     *http.Client
	Info       UserInfo
}

func NewUserRip

func NewUserRip(email string, password string) *UserRip

func (*UserRip) Do

func (u *UserRip) Do(actionConfig ActionConfig)

func (*UserRip) GetBasicInfo

func (u *UserRip) GetBasicInfo()

func (*UserRip) GetParameterKeys

func (u *UserRip) GetParameterKeys() []string

func (*UserRip) GetParametersAsUrlValues

func (u *UserRip) GetParametersAsUrlValues() url.Values

func (*UserRip) GetRequest

func (u *UserRip) GetRequest(requestUrl *url.URL) *http.Response

func (*UserRip) Rip

func (u *UserRip) Rip() bool

Login workflow; Setting policy for handling redirects by returning `http.ErrUseLastResponse` to avoid making next request automatically since is no needed for login. Cookies Gathered (minus sense() cookies):

  • sb (e.g. 'mT-kYiYOVgO1REEuVoN3QIkt')
  • c_user (e.g. 100008137277101)
  • xs (e.g. '3%3AgAfz50LpTd4C6A%3A2%3A1654931354%3A-1%3A2298')
  • fr (e.g. '0z1tHKUHfVz6RQcyW.AWXxkBqxuktzL1QQzfdJ4Z_ZeQ4.BipD-a.pb.AAA.0.0.BipD-a.AWUAUnp-IxI')

func (*UserRip) Sense

func (u *UserRip) Sense() error

Getting first set of cookies and parameters needed for make a login request Cookies Gathered:

  • datr (e.g. 'vhmkYoqy7RdEbjo_7-CfCB1A')

Parameters Gathered:

  • jazoest (e.g. 2879)
  • li (e.g 'vhmkYn8H32beqTnQp3ZeUcq3')
  • login (e.g 'Log in')
  • lsd (e.g 'AVqG3uZN6UE')
  • m_ts (e.g 1654921662)
  • try_number (e.g 0)
  • unrecognized_tries (e.g 0)

func (*UserRip) ValidCookies

func (u *UserRip) ValidCookies() bool

Validates if the user has the necessary cookies to login. Coockies = "datr", "sb", "c_user", "xs", "fr"

Jump to

Keyboard shortcuts

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