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 {
f() //f(time.Now())
}
}
func main() {
//api.SetDelay(10 * time.Second)
doEvery(10, twitter_request)
fmt.Println("Exit")
}
cGFja2FnZSBtYWluCgppbXBvcnQgKAogICJmbXQiCiAgImdpdGh1Yi5jb20vY2hpbWVyYWNvZGVyL2FuYWNvbmRhIgogICJ0aW1lIgopCgpmdW5jIHR3aXR0ZXJfcmVxdWVzdCgpIHsKCiAgYW5hY29uZGEuU2V0Q29uc3VtZXJLZXkoIiIpCiAgYW5hY29uZGEuU2V0Q29uc3VtZXJTZWNyZXQoIiIpCiAgYXBpIDo9IGFuYWNvbmRhLk5ld1R3aXR0ZXJBcGkoIiIsICIiKQogIGFwaS5SZXR1cm5SYXRlTGltaXRFcnJvcih0cnVlKQoKICBzZWFyY2hfcmVzdWx0LCBlcnIgOj0gYXBpLkdldFNlYXJjaCgiZ29sYW5nIiwgbmlsKQogIGlmIGVyciAhPSBuaWwgewogICAgICBwYW5pYyhlcnIpCiAgfQoKICBmbXQuUHJpbnRsbihsZW4oc2VhcmNoX3Jlc3VsdCkpCgogIC8vZm9yIF8sIHR3ZWV0IDo9IHJhbmdlIHNlYXJjaF9yZXN1bHQgewogICAvLyAgIGZtdC5QcmludGxuKHR3ZWV0LlRleHQpCiAgLy99Cn0KCmZ1bmMgZG9FdmVyeShkIHRpbWUuRHVyYXRpb24sIGYgZnVuYygpKSB7CiAgZm9yIHsKICAgIHRpbWUuU2xlZXAoZCkKICAgIGYoKSAvL2YodGltZS5Ob3coKSkKICB9Cn0KCmZ1bmMgbWFpbigpIHsKCiAgLy9hcGkuU2V0RGVsYXkoMTAgKiB0aW1lLlNlY29uZCkKCiAgZG9FdmVyeSgxMCwgdHdpdHRlcl9yZXF1ZXN0KQoKICBmbXQuUHJpbnRsbigiRXhpdCIpCn0=
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")
}