嘿所有我想在网页源中找到冲击波视频的参数。来源如下:
<object align="middle" width="480" height="320" viewastext="" id="player" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000">
<param value="sameDomain" name="allowScriptAccess">
<param value="http://mediawebsite.com/lcmplayer.swf?autoStart=1&hidecontrols=1&&noresize=1&file=http%3A%2F%2Ftx02.us.mediawebsite.com%2Fedge2%2F31dfty452611%26sec%3D1090" name="movie">
<param value="best" name="quality">
<param value="#000000" name="bgcolor">
<param value="true" name="allowFullScreen">
<param value="" name="FlashVars">
<embed align="middle" width="480" height="320" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="sameDomain" name="player" bgcolor="#000000" flashvars="" quality="best" src="http://mediawebsite.com/lcmplayer.swf?autoStart=1&hidecontrols=1&&noresize=1&file=http%3A%2F%2Ftx02.us.mediawebsite.com%2Fedge2%2F31dfty452611%26sec%3D1090">
</object>
我只需要从上面得到这个:
http://mediawebsite.com/lcmplayer.swf?autoStart=1&hidecontrols=1&&noresize=1&file=http%3A%2F%2Ftx02.us.mediawebsite.com%2Fedge2% 2F31dfty452611%26sec%3D1090
或&lt;中的任何内容param value =“http:// xxxxxxxxx HTML代码。当然,HTML代码链接可能会改变每次刷新,这就是为什么我需要在param中得到什么。
我正在使用标题和VB.net 2008中所述的 HtmlAgilityPack 。
这是我用来加载HTML并解析它的当前代码:
Imports HtmlAgilityPack
Imports System.Text.RegularExpressions
Private Sub getVidLink()
Dim doc As New HtmlDocument()
'doc.LoadHtml("<html><body><p><table id=""foo""><tr><th>hello</th></tr><tr><td>world</td></tr></table></body></html>")
doc.Load("C:\kathryn\fpHTML.html")
For Each table As HtmlNode In doc.DocumentNode.SelectNodes("//object")
Debug.Print("Found: " + table.Id)
For Each row As HtmlNode In table.SelectNodes("param")
Debug.Print(row.Id)
Next
Next
End Sub
但它找不到任何参数值。他们都是空白的?...
任何帮助都会很棒!
大卫
答案 0 :(得分:2)
Dim node = doc.DocumentNode.SelectSingleNode("//object/param[@name='movie']").Attributes("value").Value
应该给你你需要的东西