diff options
| author | s <[email protected]> | 2025-11-08 02:44:13 -0500 |
|---|---|---|
| committer | s <[email protected]> | 2025-11-08 02:44:13 -0500 |
| commit | dfcf52f30cdbde3a4e1400024b0c27451d179e5d (patch) | |
| tree | cdcac72f0d58b0689777644c771e80d53b502434 /cmd/x.go | |
| parent | 486a369f05125a3b86d663ea94684466e0658099 (diff) | |
| download | dborg-dfcf52f30cdbde3a4e1400024b0c27451d179e5d.tar.gz dborg-dfcf52f30cdbde3a4e1400024b0c27451d179e5d.zip | |
feat: add unauthenticated client support and new osint/x commands
Diffstat (limited to 'cmd/x.go')
| -rw-r--r-- | cmd/x.go | 54 |
1 files changed, 53 insertions, 1 deletions
@@ -32,10 +32,28 @@ var xTweetsCmd = &cobra.Command{ RunE: runXTweetsSearch, } +var xFirstCmd = &cobra.Command{ + Use: "first [username]", + Short: "Get first 20 followers of a Twitter/X account", + Long: `Retrieves the first 20 followers of a Twitter/X account`, + Args: cobra.ExactArgs(1), + RunE: runXFirstFollowers, +} + +var xNFLCmd = &cobra.Command{ + Use: "nfl [username]", + Short: "Get notable followers of a Twitter/X account", + Long: `Retrieves the notable followers (influential accounts) following a Twitter/X account`, + Args: cobra.ExactArgs(1), + RunE: runXNotableFollowers, +} + func init() { rootCmd.AddCommand(xCmd) xCmd.AddCommand(xHistoryCmd) xCmd.AddCommand(xTweetsCmd) + xCmd.AddCommand(xFirstCmd) + xCmd.AddCommand(xNFLCmd) } func runXHistorySearch(cmd *cobra.Command, args []string) error { @@ -72,7 +90,7 @@ func runXHistorySearch(cmd *cobra.Command, args []string) error { func runXTweetsSearch(cmd *cobra.Command, args []string) error { cfg := config.New() - c, err := client.New(cfg) + c, err := client.NewUnauthenticated(cfg) if err != nil { return err } @@ -88,3 +106,37 @@ func runXTweetsSearch(cmd *cobra.Command, args []string) error { return nil } + +func runXFirstFollowers(cmd *cobra.Command, args []string) error { + apiKey, _ := cmd.Flags().GetString("api-key") + cfg := config.New().WithAPIKey(apiKey) + + c, err := client.New(cfg) + if err != nil { + return err + } + + response, err := c.GetFirstFollowers(args[0]) + if err != nil { + return err + } + + return utils.PrintJSON(response) +} + +func runXNotableFollowers(cmd *cobra.Command, args []string) error { + apiKey, _ := cmd.Flags().GetString("api-key") + cfg := config.New().WithAPIKey(apiKey) + + c, err := client.New(cfg) + if err != nil { + return err + } + + response, err := c.GetNotableFollowers(args[0]) + if err != nil { + return err + } + + return utils.PrintJSON(response) +} |
