Image Extraction

This is very similar to link extraction. Instead of looking for LinkTag nodes you look for ImageTag nodes:

    import org.htmlparser.Parser;
    import org.htmlparser.util.ParserException;
    import org.htmlparser.Node;
    import org.htmlparser.tags.ImageTag;

    public class ImageDemo
    {
        public static void main (String[] args) throws ParserException
        {
            Parser parser = new Parser ("http://urlIWantToParse.com");
            Node [] images = parser.extractAllNodesThatAre (ImageTag.class);
            for (int i = 0; i < images.length; i++)
            {
                ImageTag imageTag = (ImageTag)images[i];
                System.out.println (imageTag.getImageURL ());
            }
        }
    }

    Last edited on Wednesday, January  7, 2004  5:33:01 pm.