monitor

package
v0.0.0-...-f94110d Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2015 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UserAgent   = "Monazilla/1.00 (Tomato/0.0.1)"
	BBSMenuFile = "bbsmenu.html"
	SubjectFile = "subject.txt"
)

Variables

View Source
var (
	BoardCapacity  = 1000
	ThreadCapacity = 50000
)
View Source
var BBSMenu = []string{
	`http://menu.2ch.net/bbsmenu.html`,
	`http://www.zonubbs.net/bbsmenu.html`,
	`http://azlucky.s25.xrea.com/2chboard/bbsmenu.html`,
}
View Source
var BoardURLException = map[string]bool{
	"http://jp.8ch.net/":              true,
	"http://www.2ch.net/":             true,
	"http://info.2ch.net/":            true,
	"http://irc.2ch.net:9090":         true,
	"http://search.2ch.net/":          true,
	"http://dig.2ch.net/":             true,
	"http://i.2ch.net/":               true,
	"http://www.2ch.net/kakolog.html": true,
	"http://notice.2ch.net/":          true,
	"http://be.2ch.net/":              true,
	"http://2ch.tora3.net/":           true,
}

Functions

func FetchBBSMenu

func FetchBBSMenu() (io.Reader, error)

FetchBBSMenu returns

func HTTPGet

func HTTPGet(urlStr string, gzipped bool) (*http.Response, error)

HTTPGet call HTTP GET method to urlStr with custom header recommended to access 2ch.

Types

type Board

type Board struct {
	Title      string
	URL        string
	Threadlist []*Thread
}

Board is a set of threads.

func ParseBBSMenu

func ParseBBSMenu(r io.Reader) ([]*Board, error)

ParseBBSMenu parase BBS Menu data stored in r. Data stored in r are expected to be UTF-8, so decode 2ch's default encoding (ShiftJIS) in advance.

func (*Board) FetchThreadlist

func (b *Board) FetchThreadlist() (io.Reader, error)

FetchThreadlist returns

func (*Board) ParseThreadlist

func (b *Board) ParseThreadlist(r io.Reader) error

ParseThreadlist read subject.txt and make a list of thread in b. Data stored in r is expected to be UTF-8.

type Comment

type Comment struct {
	Name    string
	Email   string
	Date    time.Time
	ID      string
	BE      string
	Content string
}

Comment

type ErrorManager

type ErrorManager struct {
	// contains filtered or unexported fields
}

ErrorManager holds

func (ErrorManager) Error

func (e ErrorManager) Error() string

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager controls

func NewManager

func NewManager() (*Manager, error)

NewManager generates new Manager with datastore path.

func (Manager) Start

func (m Manager) Start()

type Thread

type Thread struct {
	Title       string
	URL         string
	Comments    []Comment
	LastUpdated string
	Board       *Board
}

Thread

func (*Thread) FetchDatData

func (t *Thread) FetchDatData(w io.Writer) error

FetchDatData fetch dat file from specified URL and write its data to w.

func (*Thread) ParseDatData

func (t *Thread) ParseDatData(r io.Reader) error

ParseDatData parses data stored in r to Thread. r should be UTF-8 encoded. Specification is written here: http://info.2ch.net/index.php/Monazilla/develop/dat

Jump to

Keyboard shortcuts

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