Example #1
0
// 输出文本结果
// item允许的类型为map[int]interface{}或map[string]interface{}
func (self *Spider) Output(ruleName string, resp *context.Response, item interface{}) {
	resp.SetRuleName(ruleName)
	switch item2 := item.(type) {
	case map[int]interface{}:
		resp.AddItem(self.CreatItem(ruleName, item2))
	case map[string]interface{}:
		resp.AddItem(item2)
	}
}