
go爬虫
go啊go
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
最新定时器功能代码传到github上
https://github.com/yy520ltm/godpt原创 2020-09-07 05:51:20 · 221 阅读 · 0 评论 -
关于在go并发五 中 存在的问题
在 函数 TestStopTimeUpdate() 中,有这样一句代码,是存放在每一个分类下面的 书籍,然后 key 为书籍的分类名,具体的 元素 []int 为 预设的分页码,这样就达到 每一类 下面 每次都能抓取 新的书籍内容。 mapPage := make(map[string][]int) 但是 在代码中 有 对这个分页map 有读和写 操作 mapPage[tuName] = sliceInt ... ... mapPage[tuName] = mapPage[tuName][1:len(m原创 2020-08-24 06:20:03 · 229 阅读 · 0 评论 -
golang 常用工具包
convertoper package convertoper import ( "encoding/binary" "reflect" "unsafe" ) //byte数组转 int32 func BytesToInt32(buf []byte) int32 { return int32(binary.BigEndian.Uint32(buf)) } //byte数组转 int64 func BytesToInt64(buf []byte) int64 { return int64(bi原创 2020-08-22 07:07:12 · 655 阅读 · 0 评论 -
go并发5 test 测试
test 包下面 zonghengtimeupdateTest.go 免责声明 在使用本程序时,本人以供读者学习使用,并没有攻击其他网站意图,请读者设置对应源码参数时酌情考虑,切记,切记 package test // import ( "dao" "fmt" "mode" "strconv" "strings" "time" "tools/otheroper" "tools/reptilesoper/reptilesengine/gogo/dispatch" "tools/repti原创 2020-08-22 07:07:33 · 695 阅读 · 0 评论 -
go并发4 pools 协程池代码
pools包下 pool.go package pools import ( "tools/reptilesoper/reptilesengine/gogo/timerupdate" ) type GoPools struct { PoolName string //协程池名称 GoWorkNum int //协程工作的数量 通过调度层哪边根据任务情况 来安排协原创 2020-08-22 07:08:06 · 240 阅读 · 0 评论 -
go并发3 timerupdate 包 定时更新器包
timerUpdate包 有三个文件 tuclayer.go 定时更新器层 tu.go 定时更新器 task.go 任务 tuclayer.go 定时更新器层 package timerupdate import ( "time" ) //Timing updater component layer //定时更新器组件层接口 type TUCLayer struct { //定时器集合 TUs []*TimerUpdate } //创建定时器 func CreateExcuTu(timerN原创 2020-08-21 07:59:49 · 338 阅读 · 0 评论 -
go并发2 dispatch 调度层包
//dispatch 调度层包 分为三个文件 centerdispatchlayer.go //调度层 centerdispatch.go //调度器 globals.go //全局类 1:centerdispatchlayer.go package dispatch import ( "fmt" "tools/reptilesoper/reptilesengine/gogo/pools" "tools/reptilesoper/reptilesengine/gogo/timerupdate"原创 2020-08-21 07:53:58 · 531 阅读 · 0 评论 -
golang 并发( 配合爬虫写的 并发小框架)
之前前面提到 爬虫 ,只是单纯的单条执行,既然用go来写爬虫,那么必须要用到 并发来做这件事情 废话不多说,先上 设计图原创 2020-08-21 06:59:40 · 364 阅读 · 0 评论 -
go 爬虫4调用示例
test.go //初始化 func GetZX() hand.IParseProcess { var zh hand.IParseProcess = &hand.ZongHengXS{PP: struct { ClassifRequestUrl string ClassifRegexpstr string BookRequestUrl string BookRegexpstr string ChapterRequestUrl原创 2020-08-21 06:44:46 · 101 阅读 · 0 评论 -
go爬虫3
hand 包下 zonghengxs.go 免责声明: 本文章仅供于学习使用,不能拿入其他用途,后果自负哈, package hand import ( "regexp" "strconv" "strings" "tools/otheroper" ) // type ZongHengXS struct { PP ParseProcess } func (zh *ZongHengXS) GetClassifs() HandResult { content := zh.PP.GetConte原创 2020-08-21 06:36:13 · 150 阅读 · 0 评论 -
go爬虫 2
hand 包下 handresult.go package hand type IParseProcess interface { //查询书籍分类 GetClassifs() HandResult //获取某个分类下面的小说 GetBooks(classifyUrl string,pageIndex int) (HandResult,bool) //获取某个小说下面的章节 GetChapters(ChapterRequestUrl string) HandResult //获取某个小说的一原创 2020-08-21 06:32:29 · 137 阅读 · 0 评论 -
go 爬虫代码编写 (单例)
package hand import ( "fmt" "io/ioutil" "net/http" "strings" "tools/otheroper" ) //请求地址 返回内容数组流 func ReptilesDo(url string) ([]byte, error) { httprequest, err := http.NewRequest(http.MethodGet, url, nil) //httprequest.Close = true //防止Go传输本身添加原创 2020-08-21 06:27:44 · 280 阅读 · 0 评论