本文整理汇总了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)
}
}