-
-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resolves #7
- Loading branch information
Showing
113 changed files
with
14,413 additions
and
1,018 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: unfollowers | ||
on: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
env: | ||
ARCHIVE_URL: ${{ secrets.ARCHIVE_URL }} | ||
|
||
jobs: | ||
findUnfollowers: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-go@v3 | ||
with: | ||
go-version: '1.21' | ||
cache: true | ||
- name: Download instagram information locally | ||
run: go run main.go information download $ARCHIVE_URL | ||
- name: Find out which instagram users are not following back | ||
run: go run main.go followdata unfollowers | ||
- name: Cleanup local instagram information | ||
run: go run main.go information cleanup |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,2 @@ | ||
.DS_Store | ||
.idea | ||
.env | ||
instagram_data.zip | ||
instagram_data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package followdata | ||
|
||
import ( | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func NewRootCommand() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "followdata", | ||
Short: "Various instagram follow information operations", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
return cmd.Help() | ||
}, | ||
} | ||
cmd.AddCommand(NewUnfollowersCommand()) | ||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package followdata | ||
|
||
import ( | ||
"github.com/cecobask/instagram-unfollowers/pkg/instagram" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func NewUnfollowersCommand() *cobra.Command { | ||
return &cobra.Command{ | ||
Use: "unfollowers", | ||
Short: "Find out which instagram users are not following back", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
return run() | ||
}, | ||
} | ||
} | ||
|
||
func run() error { | ||
followData := instagram.NewFollowData() | ||
if err := followData.ExtractAllData(); err != nil { | ||
return err | ||
} | ||
followData.FindUnfollowers() | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package information | ||
|
||
import ( | ||
"fmt" | ||
"github.com/cecobask/instagram-unfollowers/pkg/instagram" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func NewCleanupCommand() *cobra.Command { | ||
return &cobra.Command{ | ||
Use: "cleanup", | ||
Short: "Cleanup local instagram information", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
err := instagram.CleanupInstagramInformation() | ||
if err != nil { | ||
return err | ||
} | ||
fmt.Println("cleaned up local instagram information") | ||
return nil | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package information | ||
|
||
import ( | ||
"fmt" | ||
"github.com/cecobask/instagram-unfollowers/pkg/instagram" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func NewDownloadCommand() *cobra.Command { | ||
return &cobra.Command{ | ||
Use: "download <url>", | ||
Short: "Download instagram information locally", | ||
PreRunE: func(cmd *cobra.Command, args []string) error { | ||
if len(args) != 1 { | ||
return fmt.Errorf("must provide exactly one archive download url") | ||
} | ||
return nil | ||
}, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
err := instagram.FetchInstagramInformation(args[0]) | ||
if err != nil { | ||
return err | ||
} | ||
fmt.Println("downloaded instagram information locally") | ||
return nil | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package information | ||
|
||
import "github.com/spf13/cobra" | ||
|
||
type Options struct { | ||
ArchiveDownloadURL string | ||
} | ||
|
||
func NewRootCommand() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "information", | ||
Short: "Instagram information operations", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
return cmd.Help() | ||
}, | ||
} | ||
cmd.AddCommand(NewDownloadCommand()) | ||
cmd.AddCommand(NewCleanupCommand()) | ||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package root | ||
|
||
import ( | ||
"github.com/cecobask/instagram-unfollowers/cmd/followdata" | ||
"github.com/cecobask/instagram-unfollowers/cmd/information" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
func NewRootCommand() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "instagram", | ||
Short: "Instagram operations", | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
return cmd.Help() | ||
}, | ||
CompletionOptions: cobra.CompletionOptions{ | ||
DisableDefaultCmd: true, | ||
}, | ||
SilenceUsage: true, | ||
} | ||
cmd.AddCommand(information.NewRootCommand()) | ||
cmd.AddCommand(followdata.NewRootCommand()) | ||
return cmd | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
module github.com/cecobask/instagram-unfollowers | ||
|
||
go 1.20 | ||
go 1.21 | ||
|
||
require ( | ||
github.com/jedib0t/go-pretty/v6 v6.4.6 | ||
github.com/joho/godotenv v1.5.1 | ||
github.com/jedib0t/go-pretty/v6 v6.4.7 | ||
github.com/spf13/cobra v1.7.0 | ||
) | ||
|
||
require ( | ||
github.com/inconshreveable/mousetrap v1.1.0 // indirect | ||
github.com/mattn/go-runewidth v0.0.13 // indirect | ||
github.com/rivo/uniseg v0.2.0 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
golang.org/x/sys v0.1.0 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.