Skip to content

Commit

Permalink
Minor refactors
Browse files Browse the repository at this point in the history
  • Loading branch information
Davincible committed Aug 18, 2021
1 parent 41e8dff commit 6a03701
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
38 changes: 24 additions & 14 deletions goinsta.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,17 @@ 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
// rankToken
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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
4 changes: 1 addition & 3 deletions uploads.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6a03701

Please sign in to comment.