Merge pull request #20 from MJDSys/RemoveHaveItem
Remove the haveItem check for RSS and Atom
This commit is contained in:
		
						commit
						c173d50291
					
				
					 2 changed files with 0 additions and 49 deletions
				
			
		
							
								
								
									
										24
									
								
								atom.go
									
										
									
									
									
								
							
							
						
						
									
										24
									
								
								atom.go
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -22,26 +22,6 @@ func (this *Feed) readAtom(doc *xmlx.Document) (err error) {
 | 
			
		|||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	haveItem := func(ch *Channel, id, title, desc string) bool {
 | 
			
		||||
		for _, item := range ch.Items {
 | 
			
		||||
			switch {
 | 
			
		||||
			case len(id) > 0:
 | 
			
		||||
				if item.Id == id {
 | 
			
		||||
					return true
 | 
			
		||||
				}
 | 
			
		||||
			case len(title) > 0:
 | 
			
		||||
				if item.Title == title {
 | 
			
		||||
					return true
 | 
			
		||||
				}
 | 
			
		||||
			case len(desc) > 0:
 | 
			
		||||
				if item.Description == desc {
 | 
			
		||||
					return true
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var ch *Channel
 | 
			
		||||
	var i *Item
 | 
			
		||||
	var tn *xmlx.Node
 | 
			
		||||
| 
						 | 
				
			
			@ -91,10 +71,6 @@ func (this *Feed) readAtom(doc *xmlx.Document) (err error) {
 | 
			
		|||
		list = node.SelectNodes(ns, "entry")
 | 
			
		||||
 | 
			
		||||
		for _, item := range list {
 | 
			
		||||
			if haveItem(ch, item.S(ns, "id"), item.S(ns, "title"), item.S(ns, "summary")) {
 | 
			
		||||
				continue
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			i = new(Item)
 | 
			
		||||
			i.Title = item.S(ns, "title")
 | 
			
		||||
			i.Id = item.S(ns, "id")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										25
									
								
								rss.go
									
										
									
									
									
								
							
							
						
						
									
										25
									
								
								rss.go
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -28,26 +28,6 @@ func (this *Feed) readRss2(doc *xmlx.Document) (err error) {
 | 
			
		|||
		return nil
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	haveItem := func(ch *Channel, pubdate, title, desc string) bool {
 | 
			
		||||
		for _, item := range ch.Items {
 | 
			
		||||
			switch {
 | 
			
		||||
			case len(pubdate) > 0:
 | 
			
		||||
				if item.PubDate == pubdate {
 | 
			
		||||
					return true
 | 
			
		||||
				}
 | 
			
		||||
			case len(title) > 0:
 | 
			
		||||
				if item.Title == title {
 | 
			
		||||
					return true
 | 
			
		||||
				}
 | 
			
		||||
			case len(desc) > 0:
 | 
			
		||||
				if item.Description == desc {
 | 
			
		||||
					return true
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		return false
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	var ch *Channel
 | 
			
		||||
	var i *Item
 | 
			
		||||
	var n *xmlx.Node
 | 
			
		||||
| 
						 | 
				
			
			@ -139,11 +119,6 @@ func (this *Feed) readRss2(doc *xmlx.Document) (err error) {
 | 
			
		|||
		}
 | 
			
		||||
 | 
			
		||||
		for _, item := range list {
 | 
			
		||||
			if haveItem(ch, item.S(ns, "pubDate"),
 | 
			
		||||
				item.S(ns, "title"), item.S(ns, "description")) {
 | 
			
		||||
				continue
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			i = new(Item)
 | 
			
		||||
			i.Title = item.S(ns, "title")
 | 
			
		||||
			i.Description = item.S(ns, "description")
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue