tgod

package module
v0.0.0-...-8b9afd7 Latest Latest
Warning

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

Go to latest
Published: May 10, 2017 License: GPL-3.0 Imports: 7 Imported by: 0

README

tgod 😎 - 贴吧舆情监测及干预工具 Travis branch license

注意: 项目正在开发, 目前处于不可用状态

特性

  • 简单的配置系统
  • 贴吧数据获取接口
  • 高性能数据爬虫
  • 内置数据存储
  • 贴吧数据统计
  • 帖子关键字提取

安装

二进制安装

请访问版本发布页面下载编译好的程序

源码安装

安装前请使用go version命令确认你的Go环境版本大于等于 1.8

go get -u github.com/go-tgod/tgod

FAQS

为什么这样设计...

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger = logrus.New()

Functions

func EnsureIndex

func EnsureIndex()

初始化数据库索引

func ForumUpsert

func ForumUpsert(items ...tieba.Forum) func()

func PostUpsert

func PostUpsert(items ...tieba.Post) func()

func SessionFromConfig

func SessionFromConfig() *mgo.Session

func SubPostUpsert

func SubPostUpsert(items ...tieba.SubPost) func()

func ThreadUpsert

func ThreadUpsert(items ...tieba.Thread) func()

func UpsertJob

func UpsertJob(collection *mgo.Collection, pairs ...interface{}) func()

生成用于并发处理的存储任务, 在这里我们假设每次调用产生的会话都是新产生的, 并在任务结束时释放这次会话, 因为任务是并发的, 共享会话有可能会因为共享数据库连接而阻塞达不到并发的效果, 我们不用担心产生过多的数据库连接, 因为数据库连接是通过连接池共享的

func UserUpsert

func UserUpsert(items ...tieba.User) func()

Types

type Status

type Status struct {
	ForumID        string // 贴吧ID, 根据此ID得到贴吧的更新策略
	LatestThreadID string
	LasTime        string // 最近一篇帖子的更新时间

	Interval int
}

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

初始请求, 获取置顶帖吧最新(第一页)帖子列表

Directories

Path Synopsis
based on "net/http/httputil/dump.go"
based on "net/http/httputil/dump.go"
包含了数据接口返回数据的结构, 忽略了一些无用数据和未知字段
包含了数据接口返回数据的结构, 忽略了一些无用数据和未知字段

Jump to

Keyboard shortcuts

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