response

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Caption

type Caption struct {
	// List of Edge which contains multiple nodes
	Edges []struct {
		// A single node which contains Caption text
		Node struct {
			Text string `json:"text"` // The raw caption text
		} `json:"node"`
	} `json:"edges"`
}

Caption contains the raw caption of the Instagram post

type Dimensions

type Dimensions struct {
	Height int `json:"height"` // Height of the media in pixels
	Width  int `json:"width"`  // Width of the media in pixels
}

Dimensions of the media

type EmbedResponse

type EmbedResponse struct {
	Media Media `json:"shortcode_media"` // Media
}

EmbedResponse base

func (EmbedResponse) ExtractMediaURL

func (s EmbedResponse) ExtractMediaURL() string

ExtractMediaURL will extract the Media URL automatically based on Media type (video or image)

func (EmbedResponse) GetCaption

func (s EmbedResponse) GetCaption() string

GetCaption of the Media

func (EmbedResponse) IsEmpty

func (s EmbedResponse) IsEmpty() bool

IsEmpty will return true if the Media object is empty

func (EmbedResponse) IsVideo

func (s EmbedResponse) IsVideo() bool

IsVideo will return true if the Media type is equals to video

type GrpahSQLResponse

type GrpahSQLResponse struct {
	Data struct {
		XdtShortcodeMedia struct {
			Typename                 string `json:"__typename"`
			IsXDTGraphMediaInterface string `json:"__isXDTGraphMediaInterface"`
			ID                       string `json:"id"`
			Shortcode                string `json:"shortcode"`
			ThumbnailSrc             string `json:"thumbnail_src"`
			Dimensions               struct {
				Height int `json:"height"`
				Width  int `json:"width"`
			} `json:"dimensions"`
			GatingInfo              interface{} `json:"gating_info"`
			FactCheckOverallRating  interface{} `json:"fact_check_overall_rating"`
			FactCheckInformation    interface{} `json:"fact_check_information"`
			SensitivityFrictionInfo interface{} `json:"sensitivity_friction_info"`
			SharingFrictionInfo     struct {
				ShouldHaveSharingFriction bool        `json:"should_have_sharing_friction"`
				BloksAppURL               interface{} `json:"bloks_app_url"`
			} `json:"sharing_friction_info"`
			MediaOverlayInfo interface{} `json:"media_overlay_info"`
			MediaPreview     string      `json:"media_preview"`
			DisplayURL       string      `json:"display_url"`
			DisplayResources []struct {
				Src          string `json:"src"`
				ConfigWidth  int    `json:"config_width"`
				ConfigHeight int    `json:"config_height"`
			} `json:"display_resources"`
			AccessibilityCaption interface{} `json:"accessibility_caption"`
			DashInfo             struct {
				IsDashEligible    bool        `json:"is_dash_eligible"`
				VideoDashManifest interface{} `json:"video_dash_manifest"`
				NumberOfQualities int         `json:"number_of_qualities"`
			} `json:"dash_info"`
			HasAudio                  bool        `json:"has_audio"`
			VideoURL                  string      `json:"video_url"`
			VideoViewCount            int         `json:"video_view_count"`
			VideoPlayCount            int         `json:"video_play_count"`
			EncodingStatus            interface{} `json:"encoding_status"`
			IsPublished               bool        `json:"is_published"`
			ProductType               string      `json:"product_type"`
			Title                     string      `json:"title"`
			VideoDuration             float64     `json:"video_duration"`
			ClipsMusicAttributionInfo struct {
				ArtistName            string `json:"artist_name"`
				SongName              string `json:"song_name"`
				UsesOriginalAudio     bool   `json:"uses_original_audio"`
				ShouldMuteAudio       bool   `json:"should_mute_audio"`
				ShouldMuteAudioReason string `json:"should_mute_audio_reason"`
				AudioID               string `json:"audio_id"`
			} `json:"clips_music_attribution_info"`
			IsVideo               bool        `json:"is_video"`
			TrackingToken         string      `json:"tracking_token"`
			UpcomingEvent         interface{} `json:"upcoming_event"`
			EdgeMediaToTaggedUser struct {
				Edges []struct {
					Node struct {
						User struct {
							FullName         string `json:"full_name"`
							FollowedByViewer bool   `json:"followed_by_viewer"`
							ID               string `json:"id"`
							IsVerified       bool   `json:"is_verified"`
							ProfilePicURL    string `json:"profile_pic_url"`
							Username         string `json:"username"`
						} `json:"user"`
						X  int    `json:"x"`
						Y  int    `json:"y"`
						ID string `json:"id"`
					} `json:"node"`
				} `json:"edges"`
			} `json:"edge_media_to_tagged_user"`
			Owner struct {
				ID                        string      `json:"id"`
				Username                  string      `json:"username"`
				IsVerified                bool        `json:"is_verified"`
				ProfilePicURL             string      `json:"profile_pic_url"`
				BlockedByViewer           bool        `json:"blocked_by_viewer"`
				RestrictedByViewer        interface{} `json:"restricted_by_viewer"`
				FollowedByViewer          bool        `json:"followed_by_viewer"`
				FullName                  string      `json:"full_name"`
				HasBlockedViewer          bool        `json:"has_blocked_viewer"`
				IsEmbedsDisabled          bool        `json:"is_embeds_disabled"`
				IsPrivate                 bool        `json:"is_private"`
				IsUnpublished             bool        `json:"is_unpublished"`
				RequestedByViewer         bool        `json:"requested_by_viewer"`
				PassTieringRecommendation bool        `json:"pass_tiering_recommendation"`
				EdgeOwnerToTimelineMedia  struct {
					Count int `json:"count"`
				} `json:"edge_owner_to_timeline_media"`
				EdgeFollowedBy struct {
					Count int `json:"count"`
				} `json:"edge_followed_by"`
			} `json:"owner"`
			EdgeMediaToCaption struct {
				Edges []struct {
					Node struct {
						CreatedAt string `json:"created_at"`
						Text      string `json:"text"`
						ID        string `json:"id"`
					} `json:"node"`
				} `json:"edges"`
			} `json:"edge_media_to_caption"`
			CanSeeInsightsAsBrand     bool `json:"can_see_insights_as_brand"`
			CaptionIsEdited           bool `json:"caption_is_edited"`
			HasRankedComments         bool `json:"has_ranked_comments"`
			LikeAndViewCountsDisabled bool `json:"like_and_view_counts_disabled"`
			EdgeMediaToParentComment  struct {
				Count    int `json:"count"`
				PageInfo struct {
					HasNextPage bool        `json:"has_next_page"`
					EndCursor   interface{} `json:"end_cursor"`
				} `json:"page_info"`
				Edges []struct {
					Node struct {
						ID              string `json:"id"`
						Text            string `json:"text"`
						CreatedAt       int    `json:"created_at"`
						DidReportAsSpam bool   `json:"did_report_as_spam"`
						Owner           struct {
							ID            string `json:"id"`
							IsVerified    bool   `json:"is_verified"`
							ProfilePicURL string `json:"profile_pic_url"`
							Username      string `json:"username"`
						} `json:"owner"`
						ViewerHasLiked bool `json:"viewer_has_liked"`
						EdgeLikedBy    struct {
							Count int `json:"count"`
						} `json:"edge_liked_by"`
						IsRestrictedPending  bool `json:"is_restricted_pending"`
						EdgeThreadedComments struct {
							Count    int `json:"count"`
							PageInfo struct {
								HasNextPage bool        `json:"has_next_page"`
								EndCursor   interface{} `json:"end_cursor"`
							} `json:"page_info"`
							Edges []interface{} `json:"edges"`
						} `json:"edge_threaded_comments"`
					} `json:"node"`
				} `json:"edges"`
			} `json:"edge_media_to_parent_comment"`
			EdgeMediaToHoistedComment struct {
				Edges []interface{} `json:"edges"`
			} `json:"edge_media_to_hoisted_comment"`
			EdgeMediaPreviewComment struct {
				Count int `json:"count"`
				Edges []struct {
					Node struct {
						ID              string `json:"id"`
						Text            string `json:"text"`
						CreatedAt       int    `json:"created_at"`
						DidReportAsSpam bool   `json:"did_report_as_spam"`
						Owner           struct {
							ID            string `json:"id"`
							IsVerified    bool   `json:"is_verified"`
							ProfilePicURL string `json:"profile_pic_url"`
							Username      string `json:"username"`
						} `json:"owner"`
						ViewerHasLiked bool `json:"viewer_has_liked"`
						EdgeLikedBy    struct {
							Count int `json:"count"`
						} `json:"edge_liked_by"`
						IsRestrictedPending bool `json:"is_restricted_pending"`
					} `json:"node"`
				} `json:"edges"`
			} `json:"edge_media_preview_comment"`
			CommentsDisabled            bool `json:"comments_disabled"`
			CommentingDisabledForViewer bool `json:"commenting_disabled_for_viewer"`
			TakenAtTimestamp            int  `json:"taken_at_timestamp"`
			EdgeMediaPreviewLike        struct {
				Count int           `json:"count"`
				Edges []interface{} `json:"edges"`
			} `json:"edge_media_preview_like"`
			EdgeMediaToSponsorUser struct {
				Edges []interface{} `json:"edges"`
			} `json:"edge_media_to_sponsor_user"`
			IsAffiliate                bool        `json:"is_affiliate"`
			IsPaidPartnership          bool        `json:"is_paid_partnership"`
			Location                   interface{} `json:"location"`
			NftAssetInfo               interface{} `json:"nft_asset_info"`
			ViewerHasLiked             bool        `json:"viewer_has_liked"`
			ViewerHasSaved             bool        `json:"viewer_has_saved"`
			ViewerHasSavedToCollection bool        `json:"viewer_has_saved_to_collection"`
			ViewerInPhotoOfYou         bool        `json:"viewer_in_photo_of_you"`
			ViewerCanReshare           bool        `json:"viewer_can_reshare"`
			IsAd                       bool        `json:"is_ad"`
			EdgeWebMediaToRelatedMedia struct {
				Edges []interface{} `json:"edges"`
			} `json:"edge_web_media_to_related_media"`
			CoauthorProducers []struct {
				ID            string `json:"id"`
				IsVerified    bool   `json:"is_verified"`
				ProfilePicURL string `json:"profile_pic_url"`
				Username      string `json:"username"`
			} `json:"coauthor_producers"`
			PinnedForUsers      []interface{} `json:"pinned_for_users"`
			EdgeRelatedProfiles struct {
				Edges []interface{} `json:"edges"`
			} `json:"edge_related_profiles"`
		} `json:"xdt_shortcode_media"`
	} `json:"data"`
	Extensions struct {
		IsFinal bool `json:"is_final"`
	} `json:"extensions"`
}

type Media

type Media struct {
	Id               string     `json:"id"`                    // Unique ID of the Media
	Shortcode        string     `json:"shortcode"`             // Unique shortcode of the Media
	Type             string     `json:"__typename"`            // Type of the Media
	ProductType      string     `json:"product_type"`          // Product type of the Media
	TakenAt          Time       `json:"taken_at_timestamp"`    // The time this media was taken/published
	CommenterCount   uint64     `json:"commenter_count"`       // Count of Users who have commented
	Comments         WithCount  `json:"edge_media_to_comment"` // Comments count
	Likes            WithCount  `json:"edge_liked_by"`         // Likes count
	Dimensions       Dimensions `json:"dimensions"`            // Dimensions of the Media
	DisplayURL       string     `json:"display_url"`           // URL of the Media (resolution is dynamic)
	DisplayResources []Resource `json:"display_resources"`     // Resource of the Media

	Caption Caption `json:"edge_media_to_caption"` // Media caption
	Owner   Owner   `json:"owner"`                 // User who has posted this Media

	IsVideo        bool   `json:"is_video"`         // Is type of the Media equals to video
	Title          string `json:"title"`            // The video title
	VideoURL       string `json:"video_url"`        // Direct URL to the Video
	VideoViewCount uint64 `json:"video_view_count"` // The number of times Video has been viewed

	SliderItems SliderItems `json:"edge_sidecar_to_children"` // Children of the Media

}

Media which contains a single Instagram post

type Owner

type Owner struct {
	Id                string        `json:"id"`                           // Unique ID of the User
	ProfilePictureURL string        `json:"profile_pic_url"`              // URL of user's profile picture
	Username          string        `json:"username"`                     // Username of the User
	HasPublicStory    bool          `json:"has_public_story"`             // Is the User stories publically available
	IsPrivate         bool          `json:"is_private"`                   // Is the User account private
	IsVerified        bool          `json:"is_verified"`                  // Is the User account verified
	Followers         WithCount     `json:"edge_followed_by"`             // Followers count
	Timeline          OwnerTimeline `json:"edge_owner_to_timeline_media"` // Timeline feeds of the User
}

Owner is a single Instagram user who owns the Media

type OwnerTimeline

type OwnerTimeline struct {
	Count uint64 `json:"count"` // Count of public posts
	// List of Edge which contains multiple nodes
	Edges []struct {
		// A single node which contains Thumbnail
		Node struct {
			Id                 string     `json:"string"`
			ThumbnailSrc       string     `json:"thumbnail_src"`
			ThumbnailResources []Resource `json:"thumbnail_resources"`
		} `json:"node"`
	} `json:"edges"`
}

OwnerTimeline contains the latest timeline feed of the Instagram user

type Resource

type Resource struct {
	Width  int    `json:"config_width"`  // Height of the resource media in pixels
	Height int    `json:"config_height"` // Height of the resource media in pixels
	Src    string `json:"src"`           // Direct URL to the Resource
}

Resource for an specific Media

type SliderItemNode

type SliderItemNode struct {
	Id               string     `json:"id"`                // Unique ID of the Media
	Shortcode        string     `json:"shortcode"`         // Unique shortcode of the Media
	Type             string     `json:"__typename"`        // Type of the Media
	ProductType      string     `json:"product_type"`      // Product type of the Media
	Dimensions       Dimensions `json:"dimensions"`        // Dimension of the Media
	DisplayURL       string     `json:"display_url"`       // URL of the Media (resolution is dynamic)
	DisplayResources []Resource `json:"display_resources"` // Resource of the Media

	IsVideo        bool   `json:"is_video"`         // Is type of the Media equals to video
	Title          string `json:"title"`            // The video title
	VideoURL       string `json:"video_url"`        // Direct URL to the Video
	VideoViewCount uint64 `json:"video_view_count"` // The number of times Video has been viewed

}

SliderItemNode contains information about the Instagram post

func (SliderItemNode) ExtractMediaURL

func (s SliderItemNode) ExtractMediaURL() string

ExtractMediaURL will extract the Media URL automatically based on Media type (video or image)

type SliderItems

type SliderItems struct {
	// List of Edge which contains multiple nodes
	Edges []struct {
		// A single node which contains Media item
		Node SliderItemNode `json:"node"`
	} `json:"edges"`
}

SliderItems contains list of the Instagram posts

type Time

type Time time.Time

Time defines a timestamp encoded as epoch seconds in JSON

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON is used to convert the timestamp to JSON

func (Time) String

func (t Time) String() string

String returns t as a formatted string

func (Time) Time

func (t Time) Time() time.Time

Time returns the JSON time as a time.Time instance in UTC

func (Time) Unix

func (t Time) Unix() int64

Unix returns t as a Unix time, the number of seconds elapsed since January 1, 1970 UTC. The result does not depend on the location associated with t.

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(s []byte) (err error)

UnmarshalJSON is used to convert the timestamp from JSON

type WithCount

type WithCount struct {
	Count uint64 `json:"count"` // The number of count
}

WithCount represents a single numeric Count field

Jump to

Keyboard shortcuts

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