Search code examples
vb.nettextboxgetattribute

vb.net Get value from webbrowser to textbox


I'm trying to write a code to download a movie from some website and I'm stuck with trying to get this value to textbox, however rest of this code is already done so I think, that there will be no other problems. So this's code from a website:`

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

and I would like to get this:

<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}]}">

or it may be full 4 line if this's necessery.

I've been searching a solution for last 5 hours and I can't find anything usefull...


Solution

  • A quick and dirty way to do this would be to:

    1) Download the HTML contents of the web page into a string using the following code:

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

    2) ... and then search the string for your code. One way to do this would be to first locate at which position in the HTML the string "http://stream.streamo.tv/?scode=" is located ...

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

    And then go through each subsequent character, building the code character by character, until you reach a termination character (like "&").

    I am assuming that this code only appears once on the page. If not, you will need to find a way to cycle through each instance (not difficult but not covered here).