From 6a03701b5356a6fe3aa9fb114d8079a3acc36eeb Mon Sep 17 00:00:00 2001 From: Davincible Date: Wed, 18 Aug 2021 20:06:54 +0200 Subject: [PATCH] Minor refactors --- goinsta.go | 38 ++++++++++++++++++++++++-------------- uploads.go | 4 +--- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/goinsta.go b/goinsta.go index 6d1d13c..0b16bb5 100644 --- a/goinsta.go +++ b/goinsta.go @@ -46,7 +46,7 @@ type Instagram struct { // device id: android-1923fjnma8123 dID string - // family device id: 71cd1aec-e146-4380-8d60-d216127c7b4e + // family device id, v4 uuid: 8b13e7b3-28f7-4e05-9474-358c6602e3f8 fID string // uuid: 8493-1233-4312312-5123 uuid string @@ -54,9 +54,9 @@ type Instagram struct { rankToken string // token -- I think this is depricated, as I don't see any csrf tokens being used anymore, but not 100% sure token string - // phone id + // phone id v4 uuid: fbf767a4-260a-490d-bcbb-ee7c9ed7c576 pid string - // ads id + // ads id: 5b23a92b-3228-4cff-b6ab-3199f531f05b adid string // challenge URL challengeURL string @@ -139,21 +139,38 @@ func (insta *Instagram) SetHTTPTransport(transport http.RoundTripper) { insta.c.Transport = transport } -// SetDeviceID sets device id +// SetDeviceID sets device id | android-1923fjnma8123 func (insta *Instagram) SetDeviceID(id string) { insta.dID = id } -// SetUUID sets uuid +// SetUUID sets v4 uuid | 71cd1aec-e146-4380-8d60-d216127c7b4e func (insta *Instagram) SetUUID(uuid string) { insta.uuid = uuid } -// SetPhoneID sets phone id +// SetPhoneID sets phone id, v4 uuid | fbf767a4-260a-490d-bcbb-ee7c9ed7c576 func (insta *Instagram) SetPhoneID(id string) { insta.pid = id } +// SetPhoneID sets phone family id, v4 uuid | 8b13e7b3-28f7-4e05-9474-358c6602e3f8 +func (insta *Instagram) SetFamilyID(id string) { + insta.fID = id +} + +// SetAdID sets the ad id, v4 uuid | 5b23a92b-3228-4cff-b6ab-3199f531f05b +func (insta *Instagram) SetAdID(id string) { + insta.adid = id +} + +// SetDevice allows you to set a custom device. This will also change the +// user agent based on the new device. +func (insta *Instagram) SetDevice(device Device) { + insta.device = device + insta.userAgent = createUserAgent(device) +} + // SetCookieJar sets the Cookie Jar. This further allows to use a custom implementation // of a cookie jar which may be backed by a different data store such as redis. func (insta *Instagram) SetCookieJar(jar http.CookieJar) error { @@ -275,7 +292,7 @@ func (insta *Instagram) Export(path string) error { } // Export exports selected *Instagram object options to an io.Writer -func Export(insta *Instagram, writer io.Writer) error { +func (insta *Instagram) ExportIO(writer io.Writer) error { url, err := neturl.Parse(instaAPIUrl) if err != nil { return err @@ -937,10 +954,3 @@ func (insta *Instagram) GetMedia(o interface{}) (*FeedMedia, error) { } return media, media.Sync() } - -// SetDevice allows you to set a custom device. This will also change the -// user agent based on the new device. -func (insta *Instagram) SetDevice(device Device) { - insta.device = device - insta.userAgent = createUserAgent(device) -} diff --git a/uploads.go b/uploads.go index e9af2b5..0425676 100644 --- a/uploads.go +++ b/uploads.go @@ -38,10 +38,8 @@ type UploadOptions struct { Title string IGTVPreview bool - // Set to true if you want to mute the audio - MuteAudio bool - // Option flags, set to true disable + MuteAudio bool DisableComments bool DisableLikeViewCount bool DisableSubtitles bool