func (p Parser) dropTag(selection *goquery.Selection) { selection.Each(func(i int, s *goquery.Selection) { node := s.Get(0) node.Data = s.Text() node.Type = html.TextNode }) }
func (ve *VideoExtractor) GetVideos(article *Article) *set.Set { doc := article.Doc var nodes *goquery.Selection for _, videoTag := range videoTags { tmpNodes := doc.Find(videoTag) if nodes == nil { nodes = tmpNodes } else { nodes.Union(tmpNodes) } } nodes.Each(func(i int, node *goquery.Selection) { tag := node.Get(0).DataAtom.String() var movie video switch tag { case "video": movie = ve.getVideoTag(node) break case "embed": movie = ve.getEmbedTag(node) break case "object": movie = ve.getObjectTag(node) break case "iframe": movie = ve.getIFrame(node) break default: { } } if movie.src != "" { ve.movies.Add(movie) } }) return ve.movies }