1

我正在尝试编写代码以从某个网站下载电影,并且我一直在尝试将此值传递给文本框,但是该代码的其余部分已经完成,因此我认为不会有其他问题。所以这是来自网站的代码:`

        <div style="width:750px;z-index: 0;background:#000;color:#FFF;text-align:center">
                <div class="embed">
                            <div style="height:429px;width:750px;z-index:0;position:relative;clear:both">
                <span id="206019b3744f78869b9bd120161c7b25"><object width="100%" height="100%" id="206019b3744f78869b9bd120161c7b25_api" name="206019b3744f78869b9bd120161c7b25_api" data="http://premium.iitv.info/static/player/flowplayer.commercial-3.2.15.swf" type="application/x-shockwave-flash"><param name="allowfullscreen" value="true"><param name="allowscriptaccess" value="always"><param name="quality" value="high"><param name="bgcolor" value="#000000"><param name="flashvars" value="config={&quot;key&quot;:&quot;#$3f90d28e7547ada6c98&quot;,&quot;clip&quot;:{&quot;url&quot;:&quot;http://stream.streamo.tv/?scode=w0GCOWxpkyGA4MJoRu2ETWHHZI3ZEIHojZHZPERJI9PIO90YyE0XMEQF3qUBQA1nkERocWaLaWxEipGn4cHGuuRIH9FnaM3p3fzZHq0oxyHBOERo5AGJvSKoUuHok80X4IwoIq3FhuJBe1RI5AJp30zE4MKpYS0DRAGoKczo5VmIPkTMSIzovWRpvOmE1pwM3gTo65JrlDILSyzFGMHIGWyG1c2G3pzJcEKIX9TJ0NQrSWGp1jxF4IUqeg2nepaqL5RG2cRr55zAaIKIYIKIEWwpCWJHnqmLzA1Z19RqeZmZJcUMeymoeDJGQg2pvkJq3NaZ1x2LzqyIVWyH5f2pLgTMCyIHMW1XcSzDREIGlqyDd50LIyIpbyHL1HyIUImEwuTrGAxnbuxD192Y61HLnSyHL9HBxyUokkHJj92LUSyEFMxAi1xnP1TqGWRrnSUB0N3H1W2ZTATGZyJBcWTrvIxq2LKnf9TnjSJnjtKoUy1E6WaoiZTIT52HjWSZh9RFxMJJaAmEcSKF&quot;,&quot;provider&quot;:&quot;lighttpd&quot;,&quot;scaling&quot;:&quot;fit&quot;,&quot;backgroundGradient&quot;:&quot;none&quot;,&quot;autoPlay&quot;:false,&quot;autoBuffering&quot;:false},&quot;canvas&quot;:{&quot;backgroundColor&quot;:&quot;#000&quot;,&quot;backgroundGradient&quot;:&quot;none&quot;},&quot;plugins&quot;:{&quot;lighttpd&quot;:{&quot;url&quot;:&quot;flowplayer.pseudostreaming-3.2.11.swf&quot;,&quot;queryString&quot;:&quot;%3Fstart%3D%24%7Bstart%7D&quot;},&quot;controls&quot;:{&quot;url&quot;:&quot;flowplayer.controls-3.2.14.swf&quot;,&quot;autoHide&quot;:&quot;always&quot;}},&quot;playerId&quot;:&quot;206019b3744f78869b9bd120161c7b25&quot;,&quot;playlist&quot;:[{&quot;url&quot;:&quot;http://stream.streamo.tv/?scode=w0GCOWxpkyGA4MJoRu2ETWHHZI3ZEIHojZHZPERJI9PIO90YyE0XMEQF3qUBQA1nkERocWaLaWxEipGn4cHGuuRIH9FnaM3p3fzZHq0oxyHBOERo5AGJvSKoUuHok80X4IwoIq3FhuJBe1RI5AJp30zE4MKpYS0DRAGoKczo5VmIPkTMSIzovWRpvOmE1pwM3gTo65JrlDILSyzFGMHIGWyG1c2G3pzJcEKIX9TJ0NQrSWGp1jxF4IUqeg2nepaqL5RG2cRr55zAaIKIYIKIEWwpCWJHnqmLzA1Z19RqeZmZJcUMeymoeDJGQg2pvkJq3NaZ1x2LzqyIVWyH5f2pLgTMCyIHMW1XcSzDREIGlqyDd50LIyIpbyHL1HyIUImEwuTrGAxnbuxD192Y61HLnSyHL9HBxyUokkHJj92LUSyEFMxAi1xnP1TqGWRrnSUB0N3H1W2ZTATGZyJBcWTrvIxq2LKnf9TnjSJnjtKoUy1E6WaoiZTIT52HjWSZh9RFxMJJaAmEcSKF&quot;,&quot;provider&quot;:&quot;lighttpd&quot;,&quot;scaling&quot;:&quot;fit&quot;,&quot;backgroundGradient&quot;:&quot;none&quot;,&quot;autoPlay&quot;:false,&quot;autoBuffering&quot;:false}]}"></object></span>`

我想得到这个:

<param name="flashvars" value="config={&quot;key&quot;:&quot;#$3f90d28e7547ada6c98&quot;,&quot;clip&quot;:{&quot;url&quot;:&quot;http://stream.streamo.tv/?scode=w0GCOWxpkyGA4MJoRu2ETWHHZI3ZEIHojZHZPERJI9PIO90YyE0XMEQF3qUBQA1nkERocWaLaWxEipGn4cHGuuRIH9FnaM3p3fzZHq0oxyHBOERo5AGJvSKoUuHok80X4IwoIq3FhuJBe1RI5AJp30zE4MKpYS0DRAGoKczo5VmIPkTMSIzovWRpvOmE1pwM3gTo65JrlDILSyzFGMHIGWyG1c2G3pzJcEKIX9TJ0NQrSWGp1jxF4IUqeg2nepaqL5RG2cRr55zAaIKIYIKIEWwpCWJHnqmLzA1Z19RqeZmZJcUMeymoeDJGQg2pvkJq3NaZ1x2LzqyIVWyH5f2pLgTMCyIHMW1XcSzDREIGlqyDd50LIyIpbyHL1HyIUImEwuTrGAxnbuxD192Y61HLnSyHL9HBxyUokkHJj92LUSyEFMxAi1xnP1TqGWRrnSUB0N3H1W2ZTATGZyJBcWTrvIxq2LKnf9TnjSJnjtKoUy1E6WaoiZTIT52HjWSZh9RFxMJJaAmEcSKF&quot;,&quot;provider&quot;:&quot;lighttpd&quot;,&quot;scaling&quot;:&quot;fit&quot;,&quot;backgroundGradient&quot;:&quot;none&quot;,&quot;autoPlay&quot;:false,&quot;autoBuffering&quot;:false},&quot;canvas&quot;:{&quot;backgroundColor&quot;:&quot;#000&quot;,&quot;backgroundGradient&quot;:&quot;none&quot;},&quot;plugins&quot;:{&quot;lighttpd&quot;:{&quot;url&quot;:&quot;flowplayer.pseudostreaming-3.2.11.swf&quot;,&quot;queryString&quot;:&quot;%3Fstart%3D%24%7Bstart%7D&quot;},&quot;controls&quot;:{&quot;url&quot;:&quot;flowplayer.controls-3.2.14.swf&quot;,&quot;autoHide&quot;:&quot;always&quot;}},&quot;playerId&quot;:&quot;206019b3744f78869b9bd120161c7b25&quot;,&quot;playlist&quot;:[{&quot;url&quot;:&quot;http://stream.streamo.tv/?scode=w0GCOWxpkyGA4MJoRu2ETWHHZI3ZEIHojZHZPERJI9PIO90YyE0XMEQF3qUBQA1nkERocWaLaWxEipGn4cHGuuRIH9FnaM3p3fzZHq0oxyHBOERo5AGJvSKoUuHok80X4IwoIq3FhuJBe1RI5AJp30zE4MKpYS0DRAGoKczo5VmIPkTMSIzovWRpvOmE1pwM3gTo65JrlDILSyzFGMHIGWyG1c2G3pzJcEKIX9TJ0NQrSWGp1jxF4IUqeg2nepaqL5RG2cRr55zAaIKIYIKIEWwpCWJHnqmLzA1Z19RqeZmZJcUMeymoeDJGQg2pvkJq3NaZ1x2LzqyIVWyH5f2pLgTMCyIHMW1XcSzDREIGlqyDd50LIyIpbyHL1HyIUImEwuTrGAxnbuxD192Y61HLnSyHL9HBxyUokkHJj92LUSyEFMxAi1xnP1TqGWRrnSUB0N3H1W2ZTATGZyJBcWTrvIxq2LKnf9TnjSJnjtKoUy1E6WaoiZTIT52HjWSZh9RFxMJJaAmEcSKF&quot;,&quot;provider&quot;:&quot;lighttpd&quot;,&quot;scaling&quot;:&quot;fit&quot;,&quot;backgroundGradient&quot;:&quot;none&quot;,&quot;autoPlay&quot;:false,&quot;autoBuffering&quot;:false}]}">

或者如果这是必要的,它可能是完整的 4 行。

过去 5 小时我一直在寻找解决方案,但找不到任何有用的...

4

3 回答 3

1

一种快速而肮脏的方法是:

1) 使用以下代码将网页的 HTML 内容下载为字符串:

Dim htmlContent As String = New System.Net.WebClient().DownloadString(<Enter URL Here>)

2) ...然后在字符串中搜索您的代码。一种方法是首先定位字符串“ http://stream.streamo.tv/?scode= ”在 HTML 中的哪个位置...

Dim codeLocation As Integer = htmlContent.IndexOf("http://stream.streamo.tv/?scode=")

然后遍历每个后续字符,逐个字符构建代码,直到到达终止字符(如“&”)。

我假设此代码仅在页面上出现一次。如果没有,您将需要找到一种方法来循环遍历每个实例(不难,但此处未介绍)。

于 2015-04-24T18:07:51.387 回答
0

也许它会起作用,但它是 html 代码的动态部分,因此页面源中没有链接,只有选择“检查元素”功能才能找到它......

我试图做这样的事情,但我找不到有效的解决方案......:

For Each h As HtmlElement In WebBrowser1.Document.GetElementsByTagName("value")
If Not Object.ReferenceEquals(h.GetAttribute("name"), Nothing) AndAlso h.GetAttribute("name").Equals("flashvars") Then
Tbox1.Text = h.InnerText
Exit For
End If
Next

如果我这样做:

(...).SetAttribute("Value", TextBox4.Text)

然后我可以在这里设置数据:

<param name="flashvars" value="here"></param>

但我不知道如何扭转这一点并将其发送到文本框:

?textbox1..AppendText(WebBrowser1.Document.GetAttribute("value")?
于 2015-04-24T19:52:14.970 回答
0

ChicagoMike 感谢您给我下载源代码并搜索它们的想法,但问题是如何更早地运行 javascript,但我设法通过这种方式解决了这个问题:

WebBrowser1.Document.Window.DomWindow.execscript("text/JavaScript")

    Dim MSDNpage2 As String = WebBrowser1.Document.Body.InnerHtml

    My.Computer.FileSystem.WriteAllText("e:\msdn2.txt", MSDNpage2, True)

    RichTextBox6.Text = MSDNpage2
于 2015-05-03T13:47:44.790 回答