fork download
  1. package main
  2.  
  3. import (
  4. "fmt"
  5. "github.com/chimeracoder/anaconda"
  6. "time"
  7. )
  8.  
  9. func twitter_request() {
  10.  
  11. anaconda.SetConsumerKey("")
  12. anaconda.SetConsumerSecret("")
  13. api := anaconda.NewTwitterApi("", "")
  14. api.ReturnRateLimitError(true)
  15.  
  16. search_result, err := api.GetSearch("golang", nil)
  17. if err != nil {
  18. panic(err)
  19. }
  20.  
  21. fmt.Println(len(search_result))
  22.  
  23. //for _, tweet := range search_result {
  24. // fmt.Println(tweet.Text)
  25. //}
  26. }
  27.  
  28. func doEvery(d time.Duration, f func()) {
  29. for {
  30. f() //f(time.Now())
  31. }
  32. }
  33.  
  34. func main() {
  35.  
  36. //api.SetDelay(10 * time.Second)
  37.  
  38. doEvery(10, twitter_request)
  39.  
  40. fmt.Println("Exit")
  41. }
Success #stdin #stdout 0.03s 25844KB
stdin
Standard input is empty
stdout
package main

import (
  "fmt"
  "github.com/chimeracoder/anaconda"
  "time"
)

func twitter_request() {

  anaconda.SetConsumerKey("")
  anaconda.SetConsumerSecret("")
  api := anaconda.NewTwitterApi("", "")
  api.ReturnRateLimitError(true)

  search_result, err := api.GetSearch("golang", nil)
  if err != nil {
      panic(err)
  }

  fmt.Println(len(search_result))

  //for _, tweet := range search_result {
   //   fmt.Println(tweet.Text)
  //}
}

func doEvery(d time.Duration, f func()) {
  for {
    time.Sleep(d)
    f() //f(time.Now())
  }
}

func main() {

  //api.SetDelay(10 * time.Second)

  doEvery(10, twitter_request)

  fmt.Println("Exit")
}