Html Agility Pack 寻找视频源

发布于 2024-12-18 01:30:05 字数 2450 浏览 0 评论 0原文

嘿,我正在尝试在网页源中找到冲击波视频的参数。来源看起来像这样:

    <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&amp;hidecontrols=1&amp;&amp;noresize=1&amp;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&amp;hidecontrols=1&amp;&amp;noresize=1&amp;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

< 范围内的任何内容。 param value="http://xxxxxxxxx HTML 代码。哦,当然,HTML 代码链接可能会更改每次刷新,所以这就是为什么我需要获取参数内的内容。

我正在使用 HtmlAgilityPack如标题和 VB.net 2008 中所述。

这是我当前用于加载 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

但它没有找到参数的任何值,它们都是空白的?...

任何帮助都会很棒。 !

大卫

Hey all i am trying to find the param for a shockwave video within the web page source. The source looks like this:

    <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>

I'm just needing to get this from the above:

http://mediawebsite.com/lcmplayer.swf?autoStart=1&hidecontrols=1&&noresize=1&file=http%3A%2F%2Ftx02.us.mediawebsite.com%2Fedge2%2F31dfty452611%26sec%3D1090

or whatever it could be within the < param value="http://xxxxxxxxx HTML code. Oh course that HTML code link could change every refresh so thats why i need to just get whats inside the param.

I am using HtmlAgilityPack as stated in the title and VB.net 2008.

This is my current code i am using to load the HTML and parse it:

 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

But its not finding any values for the param. They are all blank?...

Any help would be great!

David

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

天生の放荡 2024-12-25 01:30:05
Dim node = doc.DocumentNode.SelectSingleNode("//object/param[@name='movie']").Attributes("value").Value

应该给你你需要的东西

Dim node = doc.DocumentNode.SelectSingleNode("//object/param[@name='movie']").Attributes("value").Value

should give you what you need

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文