instagram

package
v1.49.1 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2022 License: OSL-3.0 Imports: 10 Imported by: 0

README

Instagram

One response looks like this:

items[0].image_versions2.candidates[0].url
Item

the other looks like this:

graphql.shortcode_media.display_url
Media

Android client

https://github.com/itsMoji/Instagram_SSL_Pinning

How to get User-Agent?

com.instagram.android

https://github.com/89z/googleplay

Why does this exist?

January 28 2022.

I use it myself.

https://instagram.com/p/CT-cnxGhvvO

Why not use other APIs?

/api/v1/media/ uses ID instead of shortcode.

/embed API does not return URLs in all cases:

https://instagram.com/p/CY-Wwq_O6S0/embed

/graphql/query/ API gets images up to 1080p, but not original quality.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Android = UserAgent{
	API:        99,
	Brand:      "brand",
	Density:    "density",
	Device:     "device",
	Instagram:  "222.0.0.15.114",
	Model:      "model",
	Platform:   "platform",
	Release:    9,
	Resolution: "9999x9999",
}
View Source
var LogLevel format.LogLevel

Functions

func Shortcode added in v1.46.7

func Shortcode(address string) string

Types

type EdgeMedia added in v1.49.1

type EdgeMedia struct {
	Edges []struct {
		Node struct {
			Text string
		}
	}
}

type GraphMedia added in v1.46.6

type GraphMedia struct {
	Display_URL                  string
	Edge_Media_To_Caption        EdgeMedia
	Edge_Media_To_Parent_Comment EdgeMedia
	Edge_Sidecar_To_Children     struct {
		Edges []struct {
			Node struct {
				Display_URL string
				Video_URL   string
			}
		}
	}
	Owner struct {
		Username string
	}
	Taken_At_Timestamp int64
	Video_URL          string
}

func NewGraphMedia added in v1.46.6

func NewGraphMedia(shortcode string) (*GraphMedia, error)

Anonymous request

func (GraphMedia) String added in v1.47.6

func (g GraphMedia) String() string

func (GraphMedia) Time added in v1.49.1

func (g GraphMedia) Time() time.Time

func (GraphMedia) URLs added in v1.46.6

func (g GraphMedia) URLs() []string

type Item added in v1.32.1

type Item struct {
	Caption struct {
		Text string
	}
	Carousel_Media []Media
	Media
	Taken_At int64
	User     struct {
		Username string
	}
}

func (Item) Format added in v1.46.6

func (i Item) Format() (string, error)

func (Item) Medias added in v1.46.6

func (i Item) Medias() []Media

func (Item) Time added in v1.48.9

func (i Item) Time() time.Time

type Login added in v1.32.1

type Login struct {
	Authorization string
}

func NewLogin added in v1.32.1

func NewLogin(username, password string) (*Login, error)

func OpenLogin added in v1.44.4

func OpenLogin(name string) (*Login, error)

func (Login) Create added in v1.44.4

func (l Login) Create(name string) error

func (Login) Items added in v1.46.6

func (l Login) Items(shortcode string) ([]Item, error)

func (Login) User added in v1.47.5

func (l Login) User(username string) (*User, error)

Use Authorization

type Media added in v1.31.9

type Media struct {
	Image_Versions2 struct {
		Candidates []struct {
			Width  int
			Height int
			URL    string
		}
	}
	Media_Type          int
	Video_DASH_Manifest string
	Video_Versions      []struct {
		Type   int
		Width  int
		Height int
		URL    string
	}
}

func (Media) URLs added in v1.45.7

func (m Media) URLs() ([]string, error)

type User added in v1.47.5

type User struct {
	Edge_Followed_By struct {
		Count int64
	}
	Edge_Follow struct {
		Count int64
	}
}

func NewUser added in v1.47.5

func NewUser(username string) (*User, error)

Anonymous request

func (User) String added in v1.47.5

func (u User) String() string

type UserAgent added in v1.46.3

type UserAgent struct {
	API        int64
	Brand      string
	Density    string
	Device     string
	Instagram  string
	Model      string
	Platform   string
	Release    int64
	Resolution string
}

I noticed that even with the posts that have `video_dash_manifest`, you have to request with a correct User-Agent. If you use wrong agent, you will get a normal response, but the `video_dash_manifest` will be missing.

func (UserAgent) String added in v1.46.3

func (u UserAgent) String() string

Jump to

Keyboard shortcuts

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