Xpath to select attributes ending with .flv

Oct 22, 2009 at 8:31 AM

Hi Guys,

im trying to use hap to parse out embed flash movies on webpages and then view the movie on my computer full screen instead of the webpages dimensions.  So far i have this code

 

WebClient w = new WebClient();
            string html = w.DownloadString("http://www.animeshippuuden.com/category/naruto-shippuuden/");

            HtmlDocument doc = new HtmlDocument();
            doc.LoadHtml(html);

            HtmlNodeCollection nodes = doc.DocumentNode.SelectNodes("//embed[@flashvars]");
            foreach (HtmlNode node in nodes)
            {
                Console.WriteLine(node.InnerHtml);
            }

however because theres another flash advertisement it will list 2 node for the embed tag.  Is there any xpath that can select only src attributes ending with a .flv?

 

Oct 22, 2009 at 8:33 AM

oops small correction the foreach loop should have 

 

Console.WriteLine(node.Attributes["flashvars"].Value);

instead

 

Oct 22, 2009 at 2:02 PM

Can't you just but an If statement in there where?

if(node.Attributes["flashvars"].Value.Contains("flv"))
{
  //Do Magic
}