本文整理匯總了Golang中github.com/ChimeraCoder/anaconda.TwitterApi.GetHomeTimeline方法的典型用法代碼示例。如果您正苦於以下問題:Golang TwitterApi.GetHomeTimeline方法的具體用法?Golang TwitterApi.GetHomeTimeline怎麽用?Golang TwitterApi.GetHomeTimeline使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/ChimeraCoder/anaconda.TwitterApi
的用法示例。
在下文中一共展示了TwitterApi.GetHomeTimeline方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: GetHomeTimeline
// 自分のTimelineを表示する。
func GetHomeTimeline(api *anaconda.TwitterApi, v url.Values) {
tweets, err := api.GetHomeTimeline(v)
check(err)
for _, tweet := range tweets {
PrintTweet(tweet)
}
}
示例2: checkForTweets
func checkForTweets(api anaconda.TwitterApi) error {
searchResult, err := api.GetHomeTimeline()
if err != nil {
log.Print("error fetching timeline: %v", err)
return err
}
//Assume that we haven't tweeted at each other more than 10 times since the last check
//Knowing us, this is a very bad assumption.
log.Printf("We have %d results", len(searchResult))
//Iterate over the tweets in chronological order (the reverse order from what is returned)
for i := len(searchResult) - 1; i >= 0; i-- {
tweet := searchResult[i]
if TweetMentionsATarget(tweet) {
if err := retweetAndLog(api, tweet); err != nil {
log.Print("error when retweeting %v", err)
continue
}
log.Print(tweet.Text)
} else {
//log.Printf("Skipping tweet %v", tweet.Text)
}
}
return nil
}
示例3: updateTimeline
func updateTimeline(api *an.TwitterApi) []an.Tweet {
v := url.Values{}
home, err := api.GetHomeTimeline(v)
if err != nil {
fmt.Println("error: ", err)
}
return home
}
示例4: showTimeLine
func showTimeLine(api *anaconda.TwitterApi, v url.Values) {
tweets, err := api.GetHomeTimeline(v)
if err != nil {
panic(err)
}
for _, tweet := range tweets {
fmt.Println("tweet: ", tweet.Text)
fmt.Println("id: ", tweet.Id)
}
}