instago

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2017 License: MIT Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Retrieve

func Retrieve(user string, id string, data chan Instagram, e chan error)

Retrieve will return the data from the user.

Types

type Filters

type Filters struct {
	After        time.Time
	Amount       int
	Before       time.Time
	CarouselOnly bool
	Text         string
	Images       bool
	Overwrite    bool
	SingleOnly   bool
	Videos       bool
	Directory    string
}

Filters is used in a channel to relay information if a post is or isn't wanted by the user.

type Images

type Images struct {
	Thumbnail struct {
		Width  int    `json:"width"`
		Height int    `json:"height"`
		URL    string `json:"url"`
	} `json:"thumbnail"`
	LowResolution struct {
		Width  int    `json:"width"`
		Height int    `json:"height"`
		URL    string `json:"url"`
	} `json:"low_resolution"`
	StandardResolution struct {
		Width  int    `json:"width"`
		Height int    `json:"height"`
		URL    string `json:"url"`
	} `json:"standard_resolution"`
}

Images has the media information about a picture

type Instagram

type Instagram struct {
	MoreAvailable bool   `json:"more_available"`
	Status        string `json:"status"`
	Items         []Post `json:"items"`
}

Instagram is JSON that Instagram uses.

type Media

type Media struct {
	Images Images `json:"images"`
	Videos Videos `json:"videos,omitempty"`
}

Media combines Images and Videos

func (Media) URL

func (m Media) URL(filter Filters) (url string, valid bool)

URL will return valid url of a media file.

type Post

type Post struct {
	ID   string `json:"id"`
	Code string `json:"code"`
	User struct {
		ID             string `json:"id"`
		FullName       string `json:"full_name"`
		ProfilePicture string `json:"profile_picture"`
		Username       string `json:"username"`
	} `json:"user"`
	Media
	CreatedTime string `json:"created_time"`
	Caption     struct {
		ID          string `json:"id"`
		Text        string `json:"text"`
		CreatedTime string `json:"created_time"`
		From        struct {
			ID             string `json:"id"`
			FullName       string `json:"full_name"`
			ProfilePicture string `json:"profile_picture"`
			Username       string `json:"username"`
		} `json:"from"`
	} `json:"caption"`
	Likes struct {
		Data []struct {
			ID             string `json:"id"`
			FullName       string `json:"full_name"`
			ProfilePicture string `json:"profile_picture"`
			Username       string `json:"username"`
		} `json:"data"`
		Count int `json:"count"`
	} `json:"likes"`
	Comments struct {
		Data []struct {
			ID          string `json:"id"`
			Text        string `json:"text"`
			CreatedTime string `json:"created_time"`
			From        struct {
				ID             string `json:"id"`
				FullName       string `json:"full_name"`
				ProfilePicture string `json:"profile_picture"`
				Username       string `json:"username"`
			} `json:"from"`
		} `json:"data"`
		Count int `json:"count"`
	} `json:"comments"`
	CanViewComments   bool   `json:"can_view_comments"`
	CanDeleteComments bool   `json:"can_delete_comments"`
	Type              string `json:"type"`
	Link              string `json:"link"`
	Location          struct {
		Name string `json:"name"`
	} `json:"location"`
	CarouselMedia []struct {
		Media
		UsersInPhoto []interface{} `json:"users_in_photo"`
		Type         string        `json:"type"`
	} `json:"carousel_media,omitempty"`
	VideoViews int `json:"video_views,omitempty"`
}

Post has the information about a single Instagram post.

func (Post) Download

func (post Post) Download(url string, filter Filters, e chan error)

Download ---

func (Post) Filter

func (post Post) Filter(filter Filters) (stop, skip bool)

Filter will check if post passes the filter and returns a bool on whether to skip or stop.

func (Post) Save

func (post Post) Save(filter Filters)

Save will get the filtered media and download the post media.

type Videos

type Videos struct {
	StandardResolution struct {
		Width  int    `json:"width"`
		Height int    `json:"height"`
		URL    string `json:"url"`
		ID     string `json:"id"`
	} `json:"standard_resolution"`
	LowBandwidth struct {
		Width  int    `json:"width"`
		Height int    `json:"height"`
		URL    string `json:"url"`
		ID     string `json:"id"`
	} `json:"low_bandwidth"`
	LowResolution struct {
		Width  int    `json:"width"`
		Height int    `json:"height"`
		URL    string `json:"url"`
		ID     string `json:"id"`
	} `json:"low_resolution"`
}

Videos has the information about a video.

Jump to

Keyboard shortcuts

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