
go爬虫
go啊go
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
最新定时器功能代码传到github上
https://github.com/yy520ltm/godpt原创 2020-09-07 05:51:20 · 227 阅读 · 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 · 232 阅读 · 0 评论 -
golang 常用工具包
convertoperpackage convertoperimport ( "encoding/binary" "reflect" "unsafe")//byte数组转 int32func BytesToInt32(buf []byte) int32 { return int32(binary.BigEndian.Uint32(buf))}//byte数组转 int64func BytesToInt64(buf []byte) int64 { return int64(bi原创 2020-08-22 07:07:12 · 658 阅读 · 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 · 696 阅读 · 0 评论 -
go并发4 pools 协程池代码
pools包下pool.gopackage poolsimport ( "tools/reptilesoper/reptilesengine/gogo/timerupdate")type GoPools struct { PoolName string //协程池名称 GoWorkNum int //协程工作的数量 通过调度层哪边根据任务情况 来安排协原创 2020-08-22 07:08:06 · 242 阅读 · 0 评论 -
go并发3 timerupdate 包 定时更新器包
timerUpdate包 有三个文件tuclayer.go 定时更新器层tu.go 定时更新器task.go 任务tuclayer.go 定时更新器层package timerupdateimport ( "time")//Timing updater component layer//定时更新器组件层接口type TUCLayer struct { //定时器集合 TUs []*TimerUpdate}//创建定时器func CreateExcuTu(timerN原创 2020-08-21 07:59:49 · 340 阅读 · 0 评论 -
go并发2 dispatch 调度层包
//dispatch 调度层包分为三个文件centerdispatchlayer.go //调度层centerdispatch.go //调度器globals.go //全局类1:centerdispatchlayer.gopackage dispatchimport ( "fmt" "tools/reptilesoper/reptilesengine/gogo/pools" "tools/reptilesoper/reptilesengine/gogo/timerupdate"原创 2020-08-21 07:53:58 · 532 阅读 · 0 评论 -
golang 并发( 配合爬虫写的 并发小框架)
之前前面提到 爬虫 ,只是单纯的单条执行,既然用go来写爬虫,那么必须要用到 并发来做这件事情废话不多说,先上 设计图原创 2020-08-21 06:59:40 · 374 阅读 · 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 · 102 阅读 · 0 评论 -
go爬虫3
hand 包下zonghengxs.go免责声明: 本文章仅供于学习使用,不能拿入其他用途,后果自负哈,package handimport ( "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 · 154 阅读 · 0 评论 -
go爬虫 2
hand 包下handresult.gopackage handtype IParseProcess interface { //查询书籍分类 GetClassifs() HandResult //获取某个分类下面的小说 GetBooks(classifyUrl string,pageIndex int) (HandResult,bool) //获取某个小说下面的章节 GetChapters(ChapterRequestUrl string) HandResult //获取某个小说的一原创 2020-08-21 06:32:29 · 139 阅读 · 0 评论 -
go 爬虫代码编写 (单例)
package handimport ( "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 · 283 阅读 · 0 评论