本文整理匯總了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"])
}
}