jbbsreader

package module
v0.0.0-...-fabedad Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2014 License: GPL-3.0 Imports: 10 Imported by: 1

README

jbbs-reader

Library to read from a JBBS board.

Documentation

Overview

Package jbbsreader provides functionality for reading from a specified JBBS board.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetGlobalRateLimitRPM

func SetGlobalRateLimitRPM(rpm int, burst int)

SetGlobalRateLimitRPM sets JBBS requests rate per limit, allowing some bursts.

Types

type Board

type Board struct {
	URL          string
	Category, ID string
}

Board represents a JBBS board whose URL is 'http://jbbs.shitaraba.net/[category]/[id]/'.

func NewBoard

func NewBoard(category, id string) *Board

NewBoard constructs a Board specified by category and id.

func (*Board) FeedNewResponses

func (b *Board) FeedNewResponses(done <-chan struct{}) (<-chan *Response, <-chan error)

FeedNewResponses continuously feeds new responses in all threads of the board to the chan. b.Category and b.ID must be set.

func (*Board) FeedResponsesOnce

func (b *Board) FeedResponsesOnce(done <-chan struct{}) (<-chan *Response, <-chan error)

FeedResponsesOnce reads all responses in all threads of the board to the chan. b.Category and b.ID must be set.

func (*Board) Threads

func (b *Board) Threads() (threads []*Thread, _ error)

Threads returns the list of threads in the board. b.Category and b.ID must be set.

type Response

type Response struct {
	ParentThread *Thread
	ID           uint   // The ID of the response, which is the same as the response number.
	Name         string // The name of the author.
	Email        string // The email address of the author.
	Date         string // The date the response was made. TODO(mogepiyo): Parse the date.
	Content      string // The content of the response. TODO(mogepiyo): Strip all tags, e.g. <br>.

	AuthorID string // The ID of the author.
	// contains filtered or unexported fields
}

Response represents each response written to JBBS threads.

type Thread

type Thread struct {
	ParentBoard  *Board
	ID           string
	Title        string // The title of the thread.
	NumResponses uint   // The number of responses in the thread.
}

Thread represents the thread that can be accessed by the following URL. 'http://jbbs.shitaraba.net/bbs/read.cgi/[board-category]/[board-id]/[thread-id]'

func (*Thread) Responses

func (t *Thread) Responses() (responses []*Response, _ error)

Responses gets all responses in the thread. t.ParentBoard and t.ID must be present.

Jump to

Keyboard shortcuts

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