new timeline subcommand

This commit is contained in:
gutmet 2020-09-20 20:37:12 +02:00
parent 9e4b1621f1
commit 368ce03487
2 changed files with 17 additions and 0 deletions

View File

@ -31,6 +31,12 @@ To get the last 200 tweets of your mention timeline:
drivel mentions drivel mentions
``` ```
To get the last 200 tweets of @USER:
```
drivel timeline USER
```
To like a tweet with a specific ID: To like a tweet with a specific ID:
``` ```

View File

@ -24,6 +24,7 @@ const (
STATUS_ENDPOINT = "https://api.twitter.com/1.1/statuses/update.json" STATUS_ENDPOINT = "https://api.twitter.com/1.1/statuses/update.json"
MENTIONS_ENDPOINT = "https://api.twitter.com/1.1/statuses/mentions_timeline.json?tweet_mode=extended&count=200" MENTIONS_ENDPOINT = "https://api.twitter.com/1.1/statuses/mentions_timeline.json?tweet_mode=extended&count=200"
HOME_ENDPOINT = "https://api.twitter.com/1.1/statuses/home_timeline.json?tweet_mode=extended&count=200" HOME_ENDPOINT = "https://api.twitter.com/1.1/statuses/home_timeline.json?tweet_mode=extended&count=200"
TIMELINE_ENDPOINT = "https://api.twitter.com/1.1/statuses/user_timeline.json?tweet_mode=extended&count=200"
LOOKUP_ENDPOINT = "https://api.twitter.com/1.1/statuses/lookup.json?tweet_mode=extended" LOOKUP_ENDPOINT = "https://api.twitter.com/1.1/statuses/lookup.json?tweet_mode=extended"
RETWEET_ENDPOINT = "https://api.twitter.com/1.1/statuses/retweet/" RETWEET_ENDPOINT = "https://api.twitter.com/1.1/statuses/retweet/"
LIKE_ENDPOINT = "https://api.twitter.com/1.1/favorites/create.json" LIKE_ENDPOINT = "https://api.twitter.com/1.1/favorites/create.json"
@ -581,6 +582,15 @@ func home(args []string) error {
return nil return nil
} }
func UserTimelineParameters(screenName string) string {
return "&screen_name=" + screenName
}
func userTimeline(args []string) error {
timeline(TIMELINE_ENDPOINT + UserTimelineParameters(args[0]))
return nil
}
func RetweetParameters(id string) string { func RetweetParameters(id string) string {
return id + ".json" return id + ".json"
} }
@ -632,6 +642,7 @@ func main() {
goutil.NewCommand("status", status, "post a status with message and/or media"), goutil.NewCommand("status", status, "post a status with message and/or media"),
goutil.NewCommand("home", home, "get your home timeline"), goutil.NewCommand("home", home, "get your home timeline"),
goutil.NewCommand("mentions", mentions, "get your mention timeline"), goutil.NewCommand("mentions", mentions, "get your mention timeline"),
goutil.NewCommand("timeline", userTimeline, "get timeline of a specific user"),
goutil.NewCommand("reply", reply, "reply to a tweet with a specific ID"), goutil.NewCommand("reply", reply, "reply to a tweet with a specific ID"),
goutil.NewCommand("quote", quote, "quote retweet a tweet with a specific ID"), goutil.NewCommand("quote", quote, "quote retweet a tweet with a specific ID"),
goutil.NewCommand("retweet", retweet, "retweet a tweet with a specific ID"), goutil.NewCommand("retweet", retweet, "retweet a tweet with a specific ID"),