Skip to content
This repository has been archived by the owner on Aug 25, 2023. It is now read-only.

Sync with master branch. #219

Merged
merged 176 commits into from
Mar 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
176 commits
Select commit Hold shift + click to select a range
9a427eb
implement UserTaggedFeed for media a used is tagged in
seankhliao Feb 20, 2018
341591d
add test for maxid/mintimestamp for UserTaggedFeed
seankhliao Feb 20, 2018
aa351f0
new response type for usertaggedfeed (#98)
Mar 14, 2018
2ba96ca
update GetUserStories
ahmdrz Mar 24, 2018
d1a532f
add story to location feeds
ahmdrz Mar 26, 2018
f53fe58
Update README.md
ahmdrz Mar 26, 2018
4f0426b
Added comments to DirectMessage function
dgrr Apr 30, 2018
f8f061a
Updated DirectListResponse
dgrr May 6, 2018
16f8de8
Adapted cursor requests in GetV2Inbox
dgrr May 6, 2018
adf3d59
V2 merged to master
dgrr May 20, 2018
93ff6c3
Changed doc.go file
dgrr May 20, 2018
3bdf951
Fixed errors
dgrr May 20, 2018
a282eb9
Changed doc.go
dgrr May 20, 2018
5d39afc
Changed examples import
dgrr May 20, 2018
a775ae0
Changed goinsta imports
dgrr May 20, 2018
47503b6
updatd readme
dgrr May 20, 2018
f312322
Updated doc.go
dgrr May 20, 2018
ddc162f
Updated utils
dgrr May 20, 2018
7b9d13e
Added Comment.Like and Unlike
dgrr May 20, 2018
0886af5
Changed requests
dgrr May 20, 2018
16f3bf2
Added Commends.Add support for Stories (incomplete)
dgrr May 20, 2018
4104927
Fixed error with GET request
dgrr May 20, 2018
920e9da
Deleted limit parameter
dgrr May 20, 2018
07ddac4
Resumed code
dgrr May 20, 2018
af63826
Added pagination for Inbox object
dgrr May 20, 2018
ef32ee5
Added next example
dgrr May 20, 2018
21006a8
Updated readme
dgrr May 20, 2018
8a0e573
fixed typo
dgrr May 20, 2018
0fa7d15
Updated README
dgrr May 20, 2018
2597a5b
Updated README 2
dgrr May 20, 2018
110f862
Added CookieJar in New function
dgrr May 20, 2018
dbcc38c
Fixed hashtag user error
dgrr May 20, 2018
a6e9ef8
Fixed https://github.com/ahmdrz/goinsta/issues/117
dgrr May 20, 2018
ae8243e
Merge branch 'master' of ssh://github.com:/ahmdrz/goinsta
dgrr May 20, 2018
fa278f3
Changed user-agent
dgrr May 21, 2018
8310e16
Added Send function to Converstions
dgrr May 21, 2018
b25837a
Added new field for requests
dgrr May 21, 2018
8088ffa
Added send message example
dgrr May 21, 2018
91ef1c7
Added documentation example
dgrr May 21, 2018
fb6e0e5
Returned to last user agent. WHY is 44 version older than 10?
dgrr May 21, 2018
a0d5e7e
Added new error type and finished Comments.Add to StoryMedia
dgrr May 21, 2018
11c0bfc
Updated example
dgrr May 21, 2018
52bf05d
Added Delete function
dgrr May 21, 2018
eac7f64
Added Like function
dgrr May 21, 2018
967d284
Added example
dgrr May 21, 2018
ce52991
Added new urls
dgrr May 21, 2018
97129d1
Added V2 parameter to request function
dgrr May 21, 2018
42071df
add SyncLikers function to get media likers
ahmdrz May 25, 2018
72793a6
update
ahmdrz May 25, 2018
4b963fb
add urlMediaLikers in const and used in SyncLikers
ahmdrz May 25, 2018
e5eb11d
Added mutual friends field
dgrr May 25, 2018
8d651fe
Updated user agent
dgrr May 25, 2018
a5d3d83
Added highligh function
dgrr May 25, 2018
e4cc701
Added highligh example
dgrr May 25, 2018
9a3e033
Added highlights command to user
dgrr May 25, 2018
fa59cde
Made SyncLikers a little private heh
dgrr May 25, 2018
177f8a9
Restored user-agent
dgrr May 26, 2018
76b4454
Added Sync function for highlights
dgrr May 26, 2018
614fb4e
Add go.mod for use with VGO
jaynagpaul May 25, 2018
92ad8be
Fixed error with highlights
dgrr May 26, 2018
4fdc427
add UploadPhoto
ahmdrz May 26, 2018
acd8748
Added NewUser function
dgrr May 27, 2018
0ca6ffe
Added field title to story media
dgrr May 27, 2018
38b3987
Added documentation
dgrr May 27, 2018
fec07ec
Changed Download function
dgrr May 27, 2018
1b90fe5
Deleted fmt and change for Join paths xd
dgrr May 27, 2018
cb8bc16
Changed Download function
dgrr May 27, 2018
98579a1
Updated info command
dgrr May 28, 2018
ae782d1
Updated Download functions
dgrr May 28, 2018
91c090e
Updated
dgrr May 28, 2018
1f7da48
Changed readme and doc.go
dgrr May 28, 2018
3355683
Updated readme
dgrr May 29, 2018
f17343c
Updated readme
dgrr May 29, 2018
54db0a0
Added GetBest
dgrr May 30, 2018
87fe7b2
Changed Download function flow execution
dgrr May 30, 2018
7d149a8
Updated setToItem function
dgrr May 30, 2018
651041f
Fixed CarouselMedia error
dgrr May 30, 2018
009fa34
Changed AcquireFeed to GetMedia
dgrr May 30, 2018
d137929
Updated exaples
dgrr May 31, 2018
a0d6672
Changed Feed parameters
dgrr May 31, 2018
809f502
Modified Sync input parameters
dgrr May 31, 2018
f23bc13
Created friendship example
dgrr May 31, 2018
47c1c5d
Updated doc
dgrr May 31, 2018
fea151a
Updated godoc info
dgrr May 31, 2018
66fbd5f
Updated Account.Feed
dgrr May 31, 2018
d1fd4fd
Fixed comment const error
dgrr May 31, 2018
3eee2e4
Added Item processing to GetBest
dgrr May 31, 2018
42cf9b8
Fixed comment retrieving error
dgrr May 31, 2018
878d3b9
Fixed error
dgrr May 31, 2018
129799f
F********************CK
dgrr May 31, 2018
1499867
Fixed comments pagination error
dgrr May 31, 2018
90973cc
New login on testing mode
dgrr Jun 1, 2018
18cbd58
Little patch to solve https://github.com/ahmdrz/goinsta/issues/123
dgrr Jun 2, 2018
7046d98
Updated sync example
dgrr Jun 2, 2018
f3b066b
Updated Sync account function
dgrr Jun 2, 2018
bf47cac
Merge branch 'master' of https://github.com/ahmdrz/goinsta
dgrr Jun 2, 2018
8aa3ed7
Deleted unneeded const
dgrr Jun 2, 2018
ab8a3f1
Added insecure mode to proxy
dgrr Jun 2, 2018
cd1b12c
Implemented new login
dgrr Jun 2, 2018
5058f40
Changed close default value by keep-alive
dgrr Jun 2, 2018
becb811
Merge branch 'master' into alpha
dgrr Jun 2, 2018
7d31228
Deleted second user agent
dgrr Jun 2, 2018
b9b6726
Fixed https://github.com/ahmdrz/goinsta/issues/120
dgrr Jun 2, 2018
00a7f39
Fixed highlights error
dgrr Jun 2, 2018
3b4758b
Updated readme
dgrr Jun 2, 2018
6cc6eb1
Create CONTRIBUTING.md
dgrr Jun 2, 2018
89ac0e5
Deleted CONTRIBUTION
dgrr Jun 2, 2018
8aa55e6
Create LICENSE
dgrr Jun 2, 2018
a1e9333
Updated readme
dgrr Jun 3, 2018
f658858
Updated readme
dgrr Jun 3, 2018
ea371a5
[Add] Other examples
alejoloaiza Jun 5, 2018
5f9ddc8
Added edit function in account update functions
dgrr Jun 5, 2018
9b4c401
Added urls
dgrr Jun 5, 2018
688ce2a
Changed example args
dgrr Jun 5, 2018
8862127
Limited item listing
dgrr Jun 5, 2018
cf96922
Fixed edit error
dgrr Jun 5, 2018
dd77dbb
Added Save function
dgrr Jun 5, 2018
16cec03
Fixed _uid paramter error
dgrr Jun 5, 2018
218c406
Added more information to error
dgrr Jun 6, 2018
31f75f4
[Add] Optional argument to modify query options
alejoloaiza Jun 7, 2018
47a7ab6
This reverts commit b4cd0fbc36549b9a2c1326628574cd1dba9834d9.
alejoloaiza Jun 7, 2018
5965727
[Add] Open posibility to change to non ranked content
alejoloaiza Jun 7, 2018
985da73
[Add] Bool in switch and comment
alejoloaiza Jun 8, 2018
70323d3
[Update] Comment typo error
alejoloaiza Jun 8, 2018
2e2e309
[Add] New method to have a way to initiate a new conversation
alejoloaiza Jun 9, 2018
fef0441
[Update] Requested changes
alejoloaiza Jun 9, 2018
5252056
[Update] fix misspell <- found by goreportcard report
alejoloaiza Jun 9, 2018
1f20a96
[Update] fix ineffassign <- found by goreportcard report
alejoloaiza Jun 9, 2018
dbd28ea
[Update] Run gofmt -s <- This was found on goreportcard.com
alejoloaiza Jun 9, 2018
1fc2fb6
Fixed test errors
dgrr Jun 9, 2018
2803e07
[Update] golint fixes reported by goreportcard.com (#135)
alejoloaiza Jun 10, 2018
27c2d8b
[Update] Adjusted using early return best practice and also to fix th…
alejoloaiza Jun 10, 2018
28f074f
Fixed go_vet errors
dgrr Jun 10, 2018
6b8d08d
[Update] Fix remaining golint issues reported, should be 100% after this
alejoloaiza Jun 11, 2018
92e5e3b
Added new error reporting types
dgrr Jun 12, 2018
1ed4048
Fixed https://github.com/ahmdrz/goinsta/issues/142
dgrr Jul 1, 2018
d75fb37
Made Account.Sync user id independent
dgrr Jul 1, 2018
95cdc4a
Fixed Save() error
dgrr Jul 1, 2018
0290b5e
Added Error function to users
dgrr Jul 3, 2018
8a4b107
Merge branch 'alpha' of ssh://github.com:/ahmdrz/goinsta into alpha
dgrr Jul 3, 2018
3a217dd
update Import and Export functions
ahmdrz Aug 8, 2018
4eb2917
merge and update Import and Export
ahmdrz Aug 8, 2018
d1f8aa0
Use int64 type for long integers where neccessary (#1)
cd2ee909 Aug 9, 2018
f2bc6d3
Fix unmarshal error on Nametag.SelfieSticker
robertgzr Aug 9, 2018
f62a70d
Unmarshall was replaced with json decoder to eliminate the problems o…
kayalardanmehmet Aug 9, 2018
81e7e58
SelfieSticker from string to interface{} avoiding json error
dgrr Aug 13, 2018
8503059
Remove duplicated functions
robertgzr Aug 9, 2018
8773afd
Add v2 suffix in go.mod module
MattKetmo Aug 26, 2018
1ec2c06
add Feed member.
ahmdrz Sep 12, 2018
06a3301
merge , Feed member added
ahmdrz Sep 12, 2018
6e9b223
feedTag moved to Feed
ahmdrz Sep 12, 2018
9c8e3e6
[Add Example] See who doesn't follow back
nsa Aug 12, 2018
32c6404
Unfollow everyone
mosoriob Sep 19, 2018
3d06d72
add SetController for User struct
ahmdrz Sep 24, 2018
76f8d43
rename SetController to SetInstagram
ahmdrz Sep 24, 2018
da56922
Update types.go fix Nametag problem (#177)
4l4 Oct 9, 2018
9f60c34
Fix file name for downloading (#182)
cheks Oct 26, 2018
3b29d11
update Gradient in Nametag
ahmdrz Nov 5, 2018
aefc1c5
Update README.md (#185)
alishavakhi Nov 20, 2018
aa250bb
Constacts synchronization added (#184)
AmaHacka Nov 21, 2018
eca9105
Media sync (#197)
sviande Jan 18, 2019
0e27491
fix #199 & #201 type mismatch (#200)
codenoid Jan 25, 2019
994aa02
using json number (#202)
jsfour Jan 27, 2019
aea1efd
update README
ahmdrz Jan 27, 2019
06a3f22
Update CONTRIBUTING.md
ahmdrz Jan 27, 2019
6802b82
Fixed type of LastSeenAt in Conversion struct
BigJk Jan 29, 2019
e6e6354
Added iterating over pending inbox messages
BigJk Jan 29, 2019
0ba606e
Updated go.mod path to /v2 (#203)
krylovsk Feb 14, 2019
3bf6fd8
Fix comments pagination
kfur Feb 22, 2019
f383e97
Fix wrong datatype (#208)
dmrlsn Feb 25, 2019
7d49846
Fix interface{} unmarshalling
dmrlsn Feb 26, 2019
d2691a8
Improves hashtags isolation/recognition
dmrlsn Feb 27, 2019
d9f6444
minor changes
dmrlsn Feb 27, 2019
37afbe8
Update README.md
ahmdrz Mar 5, 2019
8690017
Update inbox.go
inliquid Mar 9, 2019
ad4156b
Remove not used import
kfur Mar 9, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Contribution

Welcome programmer!

If you want to contribute to Goinsta API you must follow a simple instructions.

- **Test your code after making pull request**. The title says it all.
- **Include jokes if you can**. This instruction is optional.
11 changes: 0 additions & 11 deletions CONTRIBUTION.md

This file was deleted.

21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Ahmadreza Zibaei

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
114 changes: 55 additions & 59 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,70 +1,99 @@
# GoInsta. Make Goinsta Great Again!
<p align="center"><img width=100% src="https://raw.github.com/ahmdrz/goinsta/master/resources/goinsta-image.png"></p>
### Go + Instgaram API
<p align="center"><img width=100% src="https://raw.githubusercontent.com/ahmdrz/goinsta/v1/resources/goinsta-image.png"></p>

> Unofficial Instagram API for Golang

[![Build Status](https://travis-ci.org/ahmdrz/goinsta.svg?branch=master)](https://travis-ci.org/ahmdrz/goinsta) [![GoDoc](https://godoc.org/github.com/ahmdrz/goinsta?status.svg)](https://godoc.org/github.com/ahmdrz/goinsta) [![Go Report Card](https://goreportcard.com/badge/github.com/ahmdrz/goinsta)](https://goreportcard.com/report/github.com/ahmdrz/goinsta) [![Coverage Status](https://coveralls.io/repos/github/ahmdrz/goinsta/badge.svg?branch=master)](https://coveralls.io/github/ahmdrz/goinsta?branch=master)
[![GoDoc](https://godoc.org/github.com/ahmdrz/goinsta?status.svg)](https://godoc.org/github.com/ahmdrz/goinsta) [![Go Report Card](https://goreportcard.com/badge/github.com/ahmdrz/goinsta)](https://goreportcard.com/report/github.com/ahmdrz/goinsta)

## Features
### Features

* **HTTP2 by default. Goinsta uses HTTP2 client enhancing performance.**
* **Object independency. Can handle multiple instagram accounts.**
* **Like Instagram mobile application**. Goinsta is very similar to Instagram official application.
* **Simple**. Goinsta is made by lazy programmers!
* **Backup methods**. You can use `Export` and `Import` functions.
* **Security**. Your password is only required to login. After login your password is deleted.
* **No External Dependencies**. Goinsta will not use any Go packages outside of the standard library.
* **No External Dependencies**. GoInsta will not use any Go packages outside of the standard library.

## New Version !

We are working on `alpha` branch. Try it and tell us your suggestions!

The newer versions will be exported into v2 branch when new features will be well tested.

## Package installation
### Package installation

`go get -u -v gopkg.in/ahmdrz/goinsta.v2`

## CLI installation
### CLI installation

```
go get -u -v gopkg.in/ahmdrz/goinsta.v2
go install gopkg.in/ahmdrz/goinsta.v2/goinsta
```

## Example
### Example

```go
package main

import (
"fmt"

"github.com/ahmdrz/goinsta"
"gopkg.in/ahmdrz/goinsta.v2"
)

func main() {
insta := goinsta.New("USERNAME", "PASSWORD")
//insta, err := goinsta.Import("~/.goinsta")
insta := goinsta.New("USERNAME", "PASSWORD")

if err := insta.Login(); err != nil {
fmt.Println(err)
return
}
defer insta.Logout()
// also you can use New function from gopkg.in/ahmdrz/goinsta.v2/utils

...
// insta.SetProxy("http://localhost:8080", true) // true for insecure connections
if err := insta.Login(); err != nil {
fmt.Println(err)
return
}
// export your configuration
// after exporting you can use Import function instead of New function.
insta.Export("~/.goinsta")

...
}
```

In the next examples you can use an optional argument to use cache config.
* [**More Examples**](https://github.com/ahmdrz/goinsta/tree/master/examples)

### Projects using `goinsta`

* [**More Examples**](https://github.com/ahmdrz/goinsta/tree/v2/examples)
- [instagraph](https://github.com/ahmdrz/instagraph)
- [icrawler](https://github.com/themester/icrawler)
- [go-instabot](https://github.com/tducasse/go-instabot)
- [ermes](https://github.com/borteo/ermes)
- [nick\_bot](https://github.com/icholy/nick_bot)
- [goinstadownload](https://github.com/alejoloaiza/goinstadownload)
- [instafeed](https://github.com/falzm/instafeed)
- [keepig](https://github.com/seankhliao/keepig)
- ...

## Legal
### Legal

This code is in no way affiliated with, authorized, maintained, sponsored or endorsed by Instagram or any of its affiliates or subsidiaries. This is an independent and unofficial API. Use at your own risk.

## Donate
### Versioning

Goinsta used gopkg.in as versioning control. Stable new API is the version v2.0. You can get it using:
```bash
go get -u -v gopkg.in/ahmdrz/goinsta.v2
```

### New version !

We are working on a new object-oriented API. Try it and tell us your suggestions. See https://github.com/ahmdrz/goinsta/blob/master/CONTRIBUTING.md

If you want to use the old version you can found it in v1 branch or using gopkg.in/ahmdrz/goinsta.v1/

Sorry for breaking dependences :(. You can use this command in your project folder to update old master branch to v1.

```bash
for i in `grep -r ahmdrz ./ | awk '{split($0, a, ":"); print a[1]}'`; do sed -i 's/github\.com\/ahmdrz\/goinsta/gopkg\.in\/ahmdrz\/goinsta\.v1/g' $i; done
```

### Donate

**Ahmdrz**

Expand All @@ -75,38 +104,5 @@ This code is in no way affiliated with, authorized, maintained, sponsored or end
![btc](https://raw.githubusercontent.com/reek/anti-adblock-killer/gh-pages/images/bitcoin.png) Bitcoin: `37aogDJYBFkdSJTWG7TgcpgNweGHPCy1Ks`



[![Analytics](https://ga-beacon.appspot.com/UA-107698067-1/readme-page)](https://github.com/igrigorik/ga-beacon)


## Schema

Instagram
- Account: Personal information and account interactions.
- Followers
- Following
- Feed
- Stories
- Liked
- Saved
- Tags
- Profiles: User interaction.
- Blocked
- Get user using ID
- Get user using Username
- Media:
- Comments
- Likes
- Likers
- Search:
- Location
- Username
- Tags
- Location **Deprecated**
- Facebook
- Activity:
- Following
- Recent
- Hashtag: Hashtag allows user to search using hashtags.
- Stories
- Media
55 changes: 44 additions & 11 deletions account.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type Account struct {
SocialContext string `json:"social_context,omitempty"`
SearchSocialContext string `json:"search_social_context,omitempty"`
MutualFollowersCount float64 `json:"mutual_followers_count"`
LatestReelMedia int `json:"latest_reel_media,omitempty"`
LatestReelMedia int64 `json:"latest_reel_media,omitempty"`
CityID int64 `json:"city_id"`
CityName string `json:"city_name"`
AddressStreet string `json:"address_street"`
Expand All @@ -77,14 +77,11 @@ func (account *Account) Sync() error {
if err != nil {
return err
}

body, err := insta.sendRequest(
&reqOptions{
Endpoint: urlSyncProfile,
Query: generateSignature(data),
IsPost: true,
},
)
body, err := insta.sendRequest(&reqOptions{
Endpoint: urlCurrentUser,
Query: generateSignature(data),
IsPost: true,
})
if err == nil {
resp := profResp{}
err = json.Unmarshal(body, &resp)
Expand Down Expand Up @@ -246,17 +243,27 @@ func (account *Account) Following() *Users {

// Feed returns current account feed
//
// params can be:
// string: timestamp of the minimum media timestamp.
//
// minTime is the minimum timestamp of media.
//
// For pagination use FeedMedia.Next()
func (account *Account) Feed(minTime []byte) *FeedMedia {
func (account *Account) Feed(params ...interface{}) *FeedMedia {
insta := account.inst

media := &FeedMedia{}
media.inst = insta
media.timestamp = string(minTime)
media.endpoint = urlUserFeed
media.uid = account.ID

for _, param := range params {
switch s := param.(type) {
case string:
media.timestamp = s
}
}

return media
}

Expand Down Expand Up @@ -312,10 +319,36 @@ func (account *Account) Saved() (*SavedMedia, error) {
return nil, err
}

type editResp struct {
Status string `json:"status"`
Account Account `json:"user"`
}

func (account *Account) edit() {
insta := account.inst
acResp := editResp{}
body, err := insta.sendRequest(
&reqOptions{
Endpoint: urlCurrentUser,
Query: map[string]string{
"edit": "true",
},
},
)
if err == nil {
err = json.Unmarshal(body, &acResp)
if err == nil {
acResp.Account.inst = insta
*account = acResp.Account
}
}
}

// SetBiography changes your Instagram's biography.
//
// This function updates current Account information.
func (account *Account) SetBiography(bio string) error {
account.edit() // preparing to edit
insta := account.inst
data, err := insta.prepareData(
map[string]interface{}{
Expand Down
Loading