twitter

package module
v0.0.0-...-7b408d7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 24, 2014 License: MIT Imports: 3 Imported by: 0

README

Twitter Utilities

A set of tools and utilities for dealing with Tweets and Twitter content.

Requirements

The following packages are required:

  • github.com/mrjones/oauth
  • github.com/araddon/httpstream

Required packages can be installed using go get packagepath

Getting started

To fill a channel with data from the Twitter firehose:

firehose chan twitter.Tweet = make(chan twitter.Tweet, 1000)
go twitter.FillStream(firehose, "consumer key", "consumer secret", "oauth token", "oauth secret")

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FillStream

func FillStream(channel chan Tweet, consumerKey, consumerSecret, ot, osec string)

Fills a channel with data from the Twitter gardenhose.

func TweetToJSON

func TweetToJSON(tweet Tweet) ([]byte, error)

Converts a Tweet struct into a Twitter JSON object

Types

type Tweet

type Tweet struct {
	Id             int64       `json:"id"`
	Text           string      `json:"text"`
	Coordinates    interface{} `json:"coordinates"`
	Created_at_str string      `json:"created_at"`
	Lang           string      `json:"lang"`
	Timestamp      int64
	Entities       struct {
		Hashtags []struct {
			Text    string
			Indices []int
		} `json:"hashtags"`
		Urls []struct {
			Url          string
			Display_url  string
			Expanded_url string
			Indices      []int
		} `json:"urls"`
		User_mentions []struct {
			Id          int
			Screen_name string
			Name        string
			Indices     []int
		} `json:"user_mentions"`
		Media []struct {
			Media_url_https string
			Media_url       string
		} `json:"media"`
	} `json:"entities"`
	Place interface{} `json:"place"`
	User  struct {
		Statuses_count          int
		Name                    string
		Description             string
		Location                string
		Verified                bool
		Followers_count         int
		Profile_image_url_https string
		Url                     string
		Screen_name             string
		Friends_count           int
		Created_at              string
		Id                      uint64
	} `json:"user"`
	Retweeted_status interface{}
}

func JSONtoTweet

func JSONtoTweet(line []byte) Tweet

Converts a Twitter JSON object into a Tweet struct

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL