instagram

package
v1.46.3 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2022 License: OSL-3.0 Imports: 9 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 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",
	Device:     "device",
	Instagram:  "195.0.0.31.123",
	Model:      "model",
	Platform:   "platform",
	Release:    9,
	Resolution: "9999x9999",
}
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 Info added in v1.46.2

type Info 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 (Info) URLs added in v1.46.3

func (i Info) URLs() ([]string, 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(shortcode string) ([]MediaItem, error)

Request with Authorization

type MediaItem added in v1.46.2

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

func MediaItems added in v1.46.3

func MediaItems(shortcode string) ([]MediaItem, error)

Anonymous request

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 UserAgent added in v1.46.3

type UserAgent struct {
	API        int64
	Brand      string
	Density    int64
	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