instagram

package
v1.34.2 Latest Latest
Warning

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

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

README

Instagram

How to get User-Agent?

https://apkpure.com/instagram/com.instagram.android

How to get query_hash?

If you make a request like this:

GET / HTTP/1.1
Host: www.instagram.com
User-Agent: Mozilla

in the response body, you should see something like this:

<link rel="preload" href="/static/bundles/metro/Consumer.js/c705f96d9483.js"
as="script" type="text/javascript" crossorigin="anonymous" />

If you request that link:

GET /static/bundles/metro/Consumer.js/c705f96d9483.js HTTP/1.1
Host: www.instagram.com

in the response body, you should see something like this:

var
   u = "2efa04f61586458cef44441f474eee7c",
   l = "6ff3f5c474a240353993056428fb851e",
   E = "ba5c3def9f75f43213da3d428f4c783a",
   p = 40,
   v = 24,
   f = 3;

The first variable should be the target query_hash.

Documentation

Index

Constants

View Source
const (
	OriginI   = "https://i.instagram.com"
	OriginWWW = "https://www.instagram.com"
)

Variables

View Source
var Verbose = mech.Verbose

Functions

func Valid added in v1.32.4

func Valid(shortcode string) error

instagram.com/p/CT-cnxGhvvO

Types

type Edge added in v1.31.2

type Edge struct {
	Node struct {
		Display_URL string
	}
}

type Item added in v1.32.1

type Item struct {
	Media struct {
		Video_Versions []struct {
			URL string
		}
	}
}

type Login added in v1.32.1

type Login struct {
	http.Header
}

func NewLogin added in v1.32.1

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

func (*Login) Decode added in v1.32.5

func (l *Login) Decode(r io.Reader) error

This can be used to decode an existing login response.

func (Login) Encode added in v1.32.2

func (l Login) Encode(w io.Writer) error

func (Login) Item added in v1.32.1

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

type Media added in v1.31.9

type Media struct {
	Shortcode_Media struct {
		Display_URL              string
		Edge_Sidecar_To_Children *struct {
			Edges []Edge
		}
		Video_URL string
	}
}

func GraphQL added in v1.32.6

func GraphQL(shortcode string, auth *Login) (*Media, error)

If `auth` is `nil`, then anonymous request will be used.

func (Media) Edges added in v1.31.9

func (m Media) Edges() []Edge

type Query added in v1.32.3

type Query struct {
	Query_Hash string `json:"query_hash"`
	Variables  struct {
		Shortcode string `json:"shortcode"`
	} `json:"variables"`
}

func NewQuery added in v1.32.3

func NewQuery(shortcode string) Query

func (Query) Data added in v1.32.6

func (q Query) Data(auth *Login) (*Media, error)

If `auth` is `nil`, then anonymous request will be used.

Jump to

Keyboard shortcuts

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