當前位置: 首頁>>代碼示例>>Golang>>正文


Golang TwitterApi.GetUsersShow方法代碼示例

本文整理匯總了Golang中github.com/ChimeraCoder/anaconda.TwitterApi.GetUsersShow方法的典型用法代碼示例。如果您正苦於以下問題:Golang TwitterApi.GetUsersShow方法的具體用法?Golang TwitterApi.GetUsersShow怎麽用?Golang TwitterApi.GetUsersShow使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/ChimeraCoder/anaconda.TwitterApi的用法示例。


在下文中一共展示了TwitterApi.GetUsersShow方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: 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

示例2: GetFollowingNumber

func GetFollowingNumber(api *anaconda.TwitterApi, account string) int {
	searchresult, _ := api.GetUsersShow(account, nil)
	return searchresult.FriendsCount
}
開發者ID:dark-lab,項目名稱:Democracy,代碼行數:4,代碼來源:twitter.go


注:本文中的github.com/ChimeraCoder/anaconda.TwitterApi.GetUsersShow方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。