本文整理汇总了Golang中github.com/aosen/robot.PageItems.GetAll方法的典型用法代码示例。如果您正苦于以下问题:Golang PageItems.GetAll方法的具体用法?Golang PageItems.GetAll怎么用?Golang PageItems.GetAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/aosen/robot.PageItems
的用法示例。
在下文中一共展示了PageItems.GetAll方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Process
func (self *PipelineFile) Process(items *robot.PageItems, t robot.Task) {
self.file.WriteString("----------------------------------------------------------------------------------------------\n")
self.file.WriteString("Crawled url :\t" + items.GetRequest().GetUrl() + "\n")
self.file.WriteString("Crawled result : \n")
for key, value := range items.GetAll() {
self.file.WriteString(key + "\t:\t" + value + "\n")
}
}
示例2: Process
func (self *PipelineConsole) Process(items *robot.PageItems, t robot.Task) {
println("----------------------------------------------------------------------------------------------")
println("Crawled url :\t" + items.GetRequest().GetUrl() + "\n")
println("Crawled result : ")
for key, value := range items.GetAll() {
println(key + "\t:\t" + value)
}
}
示例3: novelProcess
//添加小说表
func (self *PipelineMySQL) novelProcess(pageitems *robot.PageItems, task robot.Task, firstid, secondid int64, picname string) (int64, error) {
items := pageitems.GetAll()
o := orm.NewOrm()
novel := &Novel{
Title: items["title"],
Firstid: firstid,
Secondid: secondid,
Author: items["author"],
Introduction: items["introduction"],
Picture: picname,
Novelsource: items["novelsource"],
Createtime: time.Now(),
}
//如果数据不存在 则创建
_, id, err := o.ReadOrCreate(novel, "novelsource")
return id, err
}
示例4: contentProcess
func (self *PipelineMySQL) contentProcess(pageitems *robot.PageItems, task robot.Task, novelid, firstid, secondid int64) {
items := pageitems.GetAll()
chapter, _ := strconv.Atoi(items["chapter"])
o := orm.NewOrm()
content := &Content{
Novelid: novelid,
Title: items["title"],
Firstid: firstid,
Secondid: secondid,
Chapter: chapter,
Subtitle: items["subtitle"],
Text: items["content"],
Contentsource: items["contenturl"],
Createtime: time.Now(),
}
//如果数据不存在 则创建
_, _, err := o.ReadOrCreate(content, "contentsource")
if err == nil {
log.Println("创建content成功 subtitle:", items["subtitle"])
}
}