Skip to content

GoTwitter is a light and simple to use Twitter SDK.

Notifications You must be signed in to change notification settings

ClarenceYk/gotwitter

Repository files navigation

GoTwitter - An easy to use Twitter SDK implemented using Go

Notice: This project is under development only implements Application-only authentication after the last commit.

Getting started

Install:

git clone https://github.com/ClarenceYk/gotwitter.git

Usage:

package main

import (
	"fmt"
	"log"

	"github.com/ClarenceYk/gotwitter"
)

func main() {
	app, err := gotwitter.NewApplication(
		0, // debug level
		"YourConsumerKey",
		"YourConsumerSecret",
		"YourAppName",
	)

	if err != nil {
		log.Fatalln(err)
	}

	param := &gotwitter.UserTimelineParam{
		ScreenName: "MaYukkee",
		Count:      5,
	}

	tweets, err := app.UserTimeline(param)
	if err != nil {
		log.Fatalln(err)
	} else {
		for _, tweet := range tweets {
			fmt.Println(tweet.Text)
			if tweet.QuotedStatus != nil {
				fmt.Println(tweet.QuotedStatus.Text)
			}
			if tweet.RetweetedStatus != nil {
				fmt.Println(tweet.RetweetedStatus.Text)
			}
		}
	}
}

Examples

More examples is available in application_test.go file.

About

GoTwitter is a light and simple to use Twitter SDK.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages