instagram

package
v1.45.9 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2022 License: OSL-3.0 Imports: 7 Imported by: 0

README

Instagram

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 not use other APIs?

/api/v1/media API requires separate calls for media and comments:

GET /api/v1/media/2755022163816059161/info/ HTTP/2.0
Host: i.instagram.com
user-agent: Instagram 206.1.0.34.121 Android
Authorization: Bearer IGT:2:eyJkc191c2VyX2lkIjoiNDkzNzgxNzEzMzQiLCJzZXNzaW9ua...

GET /api/v1/media/2755652849306967814/comments/ HTTP/2.0
Host: i.instagram.com
user-agent: Instagram 215.0.0.27.359 Android
Authorization: Bearer IGT:2:eyJkc191c2VyX2lkIjoiNDkzNzgxNzEzMzQiLCJzZXNzaW9ua...

/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 Valid added in v1.32.4

func Valid(shortcode string) bool

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

Types

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) Media added in v1.44.4

func (l Login) Media(shortcode string) (*Media, error)

Request with Authorization

type Media added in v1.31.9

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

func NewMedia added in v1.31.9

func NewMedia(shortcode string) (*Media, error)

Anonymous request

func (Media) String added in v1.45.4

func (m Media) String() string

func (Media) URLs added in v1.45.7

func (m Media) URLs() []string

Jump to

Keyboard shortcuts

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