instagram

package
v1.46.2 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: OSL-3.0 Imports: 9 Imported by: 0

README

Instagram

Android client

com.instagram.android

https://github.com/itsMoji/Instagram_SSL_Pinning

How to get User-Agent?

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

How to get query_hash?

Visit this page:

https://instagram.com

Then View Page Source, you should see a link like this:

https://instagram.com/static/bundles/es6/Consumer.js/341626c79aac.js

In the JavaScript source, you should see something like this:

const {data: o} = await r(d[7]).query(E, {
   shortcode: n,
   child_comment_count: f,
   fetch_comment_count: p,
   parent_comment_count: v,
   has_threaded_comments: !0
});

Then find the variable that corresponds to the first argument to the query method (E in the example above):

const E = "7d4d42b121a214d23bd43206e5142c8c",
   _ = "6ff3f5c474a240353993056428fb851e",
   u = "ba5c3def9f75f43213da3d428f4c783a",
   p = 40,
   v = 24,
   f = 3;

Why does this exist?

January 28 2022.

I use it myself.

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

Why not use other APIs?

/embed API does not return URLs in all cases:

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

__a=1 API is known to send a different response depending on the country. For example, the dfw5 location produces this result:

graphql.shortcode_media.display_resources

while the hel3 location produces this result:

items[0].carousel_media[0].image_versions2.candidates

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogLevel format.LogLevel

Functions

func GetID added in v1.46.2

func GetID(shortcode string) (uint64, error)

func Valid added in v1.32.4

func Valid(shortcode string) bool

instagram.com/p/CT-cnxGhvvO instagram.com/p/yza2PAPSx2

Types

type GraphQL added in v1.32.6

type GraphQL struct {
	Edge_Media_Preview_Like struct {
		Count int64
	}
	Display_URL              string
	Video_URL                string
	Edge_Sidecar_To_Children *struct {
		Edges []struct {
			Node struct {
				Display_URL string
				Video_URL   string
			}
		}
	}
}

func NewGraphQL added in v1.46.2

func NewGraphQL(shortcode string) (*GraphQL, error)

Anonymous request

func (GraphQL) String added in v1.46.2

func (g GraphQL) String() string

func (GraphQL) URLs added in v1.46.2

func (g GraphQL) URLs() []string

type Info added in v1.46.2

type Info struct {
	Media_Type      int
	Image_Versions2 struct {
		Candidates []Version
	}
	Video_Versions []Version
}

func (Info) Version added in v1.46.2

func (i Info) Version() (*Version, error)

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) MediaItems added in v1.46.2

func (l Login) MediaItems(id uint64) ([]MediaItem, error)

This gets us image 1241 by 1241, but requires authentication.

type MediaItem added in v1.46.2

type MediaItem struct {
	Info
	Carousel_Media []Info
	Like_Count     int64
}

func (MediaItem) Format added in v1.46.2

func (m MediaItem) Format() (string, error)

func (MediaItem) Infos added in v1.46.2

func (m MediaItem) Infos() []Info

type Version added in v1.46.2

type Version struct {
	Width  int
	Height int
	URL    string
}

Jump to

Keyboard shortcuts

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