instagram

package
v0.0.0-...-ad11637 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (

	//Error
	ErrIsNotInstagram = "Url domain is not instagram.com"
	InvalidLink       = "Invalid Link"
)
View Source
const (

	//Types
	TypeImage   = "GraphImage"
	TypeVideo   = "GraphVideo"
	TypeSidecar = "GraphSidecar"

	//Errors
	InvalidJson = "Json is invalid"
)
View Source
const (

	//Errors
	ScriptNotFound  = "Script window._sharedData not found"
	DontReadHtmlDoc = "Don`t read HTML document"
)
View Source
const (
	DontReadBody      = "Body don`t read"
	InvalidStatusCode = "StatusCode != 200"
)
View Source
const (

	//ERROR
	ErrMedias404 = "Medias not found"
)

Variables

This section is empty.

Functions

func GetAccountUrl

func GetAccountUrl(username string) string

Substitute username in link template

func GetUsernameFromUrl

func GetUsernameFromUrl(url string) (string, error)

Parce link and get username URL should be like https://www.instagram.com/username/

Types

type Account

type Account struct {
	Id          string
	Username    string
	FullName    string
	Biography   string
	ExternalUrl string
	Followers   uint32
	Follows     uint32
	IsPrivate   bool
	IsVerified  bool
	MediaCount  uint32
	Image       struct {
		ProfilePicUrl   string
		ProfilePicUrlHd string
	}
}

An Account describes an Instagram account info.

func GetAccountByUrl

func GetAccountByUrl(accountUrl string) (*Account, error)

GetAccountByUrl try to find account by url.

func GetAccountByUsername

func GetAccountByUsername(username string) (*Account, error)

Get Account Struct from username

type Media

type Media struct {
	Id         string
	Type       string
	Caption    string
	Shortcode  string
	Comments   int
	Dimensions struct {
		Height int
		Width  int
	}
	DisplayUrl string
	Likes      int
	IsVideo    bool
	VideoViews int
	Resources  []Resource
	Time       time.Time
}

An Medias describes an Instagram media info.

func GetLastMediasByUrl

func GetLastMediasByUrl(accountUrl string) ([]Media, error)

GetAccountMedia try to get slice of user's media from the main page by url.

func GetLastMediasByUsername

func GetLastMediasByUsername(username string) ([]Media, error)

GetAccountMedia try to get slice of user's media from the main page by username.

func GetMediaByShortCode

func GetMediaByShortCode(code string) (*Media, error)

GetMediaByShortCode try to find media by code. Code can be find in URL to media, after p/. If URL to media is https://www.instagram.com/p/XXXXXXXXXX/, then code of the media is XXXXXXXXXX.

func GetMediaByUrl

func GetMediaByUrl(url string) (*Media, error)

GetMediaByUrl try to find media by url. URL should be like https://www.instagram.com/p/XXXXXXXXXX/

type Resource

type Resource struct {
	Src          string `json:"src"`
	ConfigWidth  int    `json:"config_width"`
	ConfigHeight int    `json:"config_height"`
}

Resource struct contains part information about media

Jump to

Keyboard shortcuts

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