当前位置: 首页>>代码示例>>Golang>>正文


Golang TwitterApi.GetUserTimeline方法代码示例

本文整理汇总了Golang中github.com/ChimeraCoder/anaconda.TwitterApi.GetUserTimeline方法的典型用法代码示例。如果您正苦于以下问题:Golang TwitterApi.GetUserTimeline方法的具体用法?Golang TwitterApi.GetUserTimeline怎么用?Golang TwitterApi.GetUserTimeline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/ChimeraCoder/anaconda.TwitterApi的用法示例。


在下文中一共展示了TwitterApi.GetUserTimeline方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: GenerateFireworkFor

func GenerateFireworkFor(api *anaconda.TwitterApi, t *anaconda.Tweet) error {

	checkFile := MakeGifFilename(t.User.ScreenName, t.Id)
	if Exists(checkFile) {
		fmt.Println("Already Exsists")
		return nil
	}

	v := url.Values{}
	v.Set("screen_name", t.User.ScreenName)
	v.Set("count", "30")
	search_result, err := api.GetUserTimeline(v)
	if err != nil {
		return err
	}

	gifFile, e := genTwitterGif(search_result, t.User.ScreenName, t.Id)
	if e != nil {
		return e
	}

	if *live {
		return postImageTweet(api, gifFile, t)
	} else {
		fmt.Println("Not live: ", live, t.User.ScreenName, gifFile)
	}

	return nil
}
开发者ID:Kimau,项目名称:ProcJam15,代码行数:29,代码来源:main.go

示例2: ShowTimeline

// 指定したユーザのTweetを表示する。
func ShowTimeline(api *anaconda.TwitterApi, v url.Values, screenName string) {
	v.Set("screen_name", screenName)
	tweets, err := api.GetUserTimeline(v)
	check(err)
	for _, tweet := range tweets {
		PrintTweet(tweet)
	}
}
开发者ID:honeybe,项目名称:code-sample,代码行数:9,代码来源:main.go

示例3: getLatestTweets

func getLatestTweets(client *anaconda.TwitterApi, screenName string, length int) (tweets []anaconda.Tweet, err error) {
	query := url.Values{}
	query.Set("screen_name", screenName)
	query.Set("count", fmt.Sprintf("%v", length))
	query.Set("trim_user", "true")
	query.Set("exclude_replies", "true")
	query.Set("include_rts", "true")
	return client.GetUserTimeline(query)
}
开发者ID:djui,项目名称:potd,代码行数:9,代码来源:twitter.go

示例4: isTweeted

func isTweeted(subject string, api anaconda.TwitterApi) bool {
	tweets, err := api.GetUserTimeline(nil)
	if err != nil {
		fmt.Println("Getting User timeline failed! Error : ", err)
		os.Exit(1)
	}
	for _, tweet := range tweets {
		fmt.Println(tweet.Text)
		fmt.Println("searching subject :" + subject)
		found := strings.Contains(tweet.Text, subject)

		if found {
			return true
		}
	}
	return false
}
开发者ID:istanbul-coders,项目名称:monsterghost,代码行数:17,代码来源:tweet.go

示例5: GetTweets

func GetTweets(api anaconda.TwitterApi, username string) []anaconda.Tweet {
	v := url.Values{}
	v.Set("screen_name", username)
	v.Set("include_rts", "1")
	v.Set("count", "100")
	tweets, err := api.GetUserTimeline(v)
	if err != nil {
		glog.Fatal("Wasn't able to get user's timeline")
	}
	glog.V(2).Infof("Fetched %d tweets from user %s", len(tweets), username)

	glog.V(2).Info("Closing Polygons on tweets")
	// Close those polygons because ES can't handle a non-closed GeoJSON polygon
	for _, tweet := range tweets {
		ClosePlacePolygon(&tweet)
	}

	return tweets
}
开发者ID:tebriel,项目名称:follow_stats,代码行数:19,代码来源:twitter.go

示例6: GetTimelines

func GetTimelines(api *anaconda.TwitterApi, account string, since int64) timelinesTweets {
	myTweets := make(timelinesTweets)
	var max_id int64
	var tweet anaconda.Tweet
	searchresult, _ := api.GetUsersShow(account, nil)
	v := url.Values{}
	var timeline []anaconda.Tweet
	var Tweettime string
	v.Set("user_id", searchresult.IdStr)
	v.Set("count", "1") //getting twitter first tweet
	timeline, _ = api.GetUserTimeline(v)
	max_id = timeline[0].Id // putting it as max_id
	time, _ := timeline[0].CreatedAtTime()

	for time.Unix() >= since { //until we don't exceed our range of interest

		v = url.Values{}
		v.Set("user_id", searchresult.IdStr)
		v.Set("count", "200")
		v.Set("max_id", strconv.FormatInt(max_id, 10))
		timeline, _ = api.GetUserTimeline(v)
		for _, tweet = range timeline {

			time, _ = tweet.CreatedAtTime()
			myTweets[tweet.IdStr] = tweet
			Tweettime = fmt.Sprintf("%d-%02d-%02dT%02d:%02d:%02d", time.Year(), time.Month(), time.Day(), time.Hour(), time.Minute(), time.Second())
			log.Info("\tTweet @ " + Tweettime + " : " + tweet.IdStr)
			max_id = tweet.Id
		}
		log.Info("\tFinished reading timeslice for " + account)
	}
	log.Info("\tFinished reading timeline for " + account)

	return myTweets

}
开发者ID:dark-lab,项目名称:Democracy,代码行数:36,代码来源:twitter.go


注:本文中的github.com/ChimeraCoder/anaconda.TwitterApi.GetUserTimeline方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。