Documentation ¶
Index ¶
- Variables
- func EnsureIndex()
- func ForumUpsert(items ...tieba.Forum) func()
- func PostUpsert(items ...tieba.Post) func()
- func SessionFromConfig() *mgo.Session
- func SubPostUpsert(items ...tieba.SubPost) func()
- func ThreadUpsert(items ...tieba.Thread) func()
- func UpsertJob(collection *mgo.Collection, pairs ...interface{}) func()
- func UserUpsert(items ...tieba.User) func()
- type Status
- type TiebaSpider
Constants ¶
This section is empty.
Variables ¶
View Source
var Logger = logrus.New()
Functions ¶
func ForumUpsert ¶
func PostUpsert ¶
func SessionFromConfig ¶
func SessionFromConfig() *mgo.Session
func SubPostUpsert ¶
func ThreadUpsert ¶
func UpsertJob ¶
func UpsertJob(collection *mgo.Collection, pairs ...interface{}) func()
生成用于并发处理的存储任务, 在这里我们假设每次调用产生的会话都是新产生的, 并在任务结束时释放这次会话, 因为任务是并发的, 共享会话有可能会因为共享数据库连接而阻塞达不到并发的效果, 我们不用担心产生过多的数据库连接, 因为数据库连接是通过连接池共享的
func UserUpsert ¶
Types ¶
type TiebaSpider ¶
type TiebaSpider struct {
// contains filtered or unexported fields
}
func NewTiebaSpider ¶
func NewTiebaSpider(forum string) *TiebaSpider
func (*TiebaSpider) ParsePostList ¶
func (t *TiebaSpider) ParsePostList(res *gen.Response, helper talpa.Helper)
解析后续回帖
func (*TiebaSpider) ParsePostListPage ¶
func (t *TiebaSpider) ParsePostListPage(res *gen.Response, helper talpa.Helper)
解析第一页回帖, 生成后序的请求
func (*TiebaSpider) ParseThreadList ¶
func (t *TiebaSpider) ParseThreadList(res *gen.Response, helper talpa.Helper)
解析帖子列表, 生成每个帖子回复列表第一页请求用于得到回帖页数进行下一步请求
func (*TiebaSpider) StartRequests ¶
func (t *TiebaSpider) StartRequests() []*gen.Request
初始请求, 获取置顶帖吧最新(第一页)帖子列表
Click to show internal directories.
Click to hide internal directories.