[Pholcus] Go项目 Pholcus 源码逻辑分析 species.go

「代码结构」

结构体:蜘蛛种类列表(即:蜘蛛规则列表)

变量:全局蜘蛛种类实例

方法:向蜘蛛种类清单添加新种类

方法:获取全部蜘蛛种类

方法:通过名字获取蜘蛛

「总体功能」

添加新种类:通过 Spider.name 作为键,Spider 作为值,添加到 SpiderSpecies.hash 中。

获取全部蜘蛛种类:SpiderSpecies.sorted 是false时,按照拼音排序修改 SpiderSpecies.list 并返回,SpiderSpecies.sorted 设为true.

通过名字获取蜘蛛:通过 SpiderSpecies.hash [ name ] 获取蜘蛛。

Refer:Pholcus项目用法

Other:https://www.cnblogs.com/SSSR/tag/golang/

Link:https://www.cnblogs.com/farwish/p/15662781.html

原文地址:https://www.cnblogs.com/farwish/p/15662781.html