From 368ce03487605627f0f9899c4ec3d27763c9a591 Mon Sep 17 00:00:00 2001 From: gutmet Date: Sun, 20 Sep 2020 20:37:12 +0200 Subject: [PATCH] new timeline subcommand --- Readme.md | 6 ++++++ drivel.go | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/Readme.md b/Readme.md index e0964d0..7a2d784 100644 --- a/Readme.md +++ b/Readme.md @@ -31,6 +31,12 @@ To get the last 200 tweets of your mention timeline: drivel mentions ``` +To get the last 200 tweets of @USER: + +``` +drivel timeline USER +``` + To like a tweet with a specific ID: ``` diff --git a/drivel.go b/drivel.go index 5f9e451..afe85ce 100644 --- a/drivel.go +++ b/drivel.go @@ -24,6 +24,7 @@ const ( 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" 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" RETWEET_ENDPOINT = "https://api.twitter.com/1.1/statuses/retweet/" LIKE_ENDPOINT = "https://api.twitter.com/1.1/favorites/create.json" @@ -581,6 +582,15 @@ func home(args []string) error { 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 { return id + ".json" } @@ -632,6 +642,7 @@ func main() { goutil.NewCommand("status", status, "post a status with message and/or media"), goutil.NewCommand("home", home, "get your home 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("quote", quote, "quote retweet a tweet with a specific ID"), goutil.NewCommand("retweet", retweet, "retweet a tweet with a specific ID"),