Page 3 of 4
Re: Create Custom Download Manager for VB Webbrowser?!
Posted: Tue Mar 08, 2011 3:49 pm
by Napster1488
Usman55 wrote:Try the method which mandai supplied at first. In there put the code e.cancel and the code to open the downloader and also add the code to add the url to the downloader's textbox.
The e.cancel Code doesnt work on the "FileDownload" event.
I also tryd to get the Current URL in a Textbox , but when Download Window appears i can not see the Download URL in the TextBox , i tryd to use the download code downloader.downloadfileasync(e.url,"My Path" & "/Filename")
but it doesnt work.
I also tryd adding this to the Navigating Event .
Code: Select allIF Webbrowser1.Document.IsFile=true then
downloader.downloadfileasync(webbrowser1.url,"My Path" & "/Filename")
it doesnt work too.
EDIT:
Maybe i will try to use the GeckoBrowser , its better with such Events then the IE WebBrowser.
Anyway someone knows if its possible to use the GeckoBrowser in my Application without the XULRunner ?
Maybe with a couple of DLL´s from it?!
Re: Create Custom Download Manager for VB Webbrowser?!
Posted: Tue Mar 08, 2011 4:51 pm
by Usman55
I meant the method which mandai told and not the FileDownload one. That method worked for me. I have tried it several times... And please forget ie webbrowser control because it's just too slow and it doesn't even have good features. Switch to webkit or some other control.
Re: Create Custom Download Manager for VB Webbrowser?!
Posted: Tue Mar 08, 2011 5:18 pm
by Napster1488
Usman55 wrote:I meant the method which mandai told and not the FileDownload one. That method worked for me. I have tried it several times... And please forget ie webbrowser control because it's just too slow and it doesn't even have good features. Switch to webkit or some other control.
Ok
Re: Create Custom Download Manager for VB Webbrowser?!
Posted: Wed Mar 09, 2011 11:18 pm
by Napster1488
Hey Guys,
i downloadet now the WebKit Webbrowser...
In the "DownloadBegin" Event i added a MessageBox Code just to see if something happens...
But when i try to Download a File then the messagebox dont appear.
And in the "Navigating" Event i added this Code
Code: Select allIf WebKitBrowser1.url.isfile=true then
msgbox("Download",msgboxstyle.information)
But also nothing happens , someone can help ?!
EDIT:
i got it working now to download a file with it but with the navigating event ,
but anyway i can not get it working trough the direct download with my javascipt...
anyway this is the javascript i am using its for download youtube videos
Code: Select alljavascript:isIE=/*@cc_on!@*/false;isIE ? swfHTML=document.getElementById('movie_player').getElementsByTagName('param')[1].value:swfHTML=document.getElementById("movie_player").getAttribute("flashvars");w=swfHTML.split("&");for(i=0;i<=w.length-1;i++)if(w[i].split("=")[0] == "fmt_url_map"){links=unescape(w[i].split("=")[1]);break;}abc = links.split(",");for(i=0;i<=abc.length-1;i++){fmt=abc[i].split("|")[0];if(fmt==34){url = abc[i].split("|")[1] + '&title=' + (((document.title.replace('#',' ')).replace('@',' ')).replace('*',' ')).replace('|',' ');window.location.href = url;}}
maybe someone can edit this javascript and make that i can use it on other way in visual basic ?
Re: Create Custom Download Manager for VB Webbrowser?!
Posted: Thu Mar 10, 2011 7:24 am
by Usman55
Are you trying to download youtube videos? I have a great idea! In the webbrowser navigating event, add this code:
If TextBox1.Text.Contains ("youtube") Then
(Enter The Javascript Here)
End If
I don't know where how and where to enter the javascript so you can do it yourself. I'll try and find a better script for youtube downloading. The basic thing is that you can add in the code to download the video if the text of the textbox (or the text in which your browser's url is located) contains the word youtube or anything similar. I am also going to upload my Youtube Download Source Code so I hope that will help you in some way.
Re: Create Custom Download Manager for VB Webbrowser?!
Posted: Thu Mar 10, 2011 12:20 pm
by mandai
In order for that JavaScript code to be useful we need to know the method that the flash player uses to find the flv file.
Re: Create Custom Download Manager for VB Webbrowser?!
Posted: Thu Mar 10, 2011 1:47 pm
by Napster1488
Ok,but that IF textbox.contains("youtube") will not help me , cause i am using Webkit , and when i enter the JavaScript nothing happens cause in the moment i didnt got the DownloadBegin event not working.
I just tryd something with navigating event and added there
Code: Select alltextbox1.text=e.url
if textbox1.text.endswith(".exe") then
msgbox("Download",msgboystyle.information)
downloader.downloadfileasync(textbox1.text,my.computer.filesystem.specialdirectories.desktop & "/Datei.exe")
I just tryd this with exe to see if it works , and yes it worked.
But i need to get the actual url of the browser when i enter the javascript soo downloader can download it then.
Re: Create Custom Download Manager for VB Webbrowser?!
Posted: Thu Mar 10, 2011 4:16 pm
by Usman55
Isn't there a webbrowser navigating event? In the navigating event you can add the code to get it's url. Try that, and you might get the solution.
Re: Create Custom Download Manager for VB Webbrowser?!
Posted: Thu Mar 10, 2011 4:46 pm
by mandai
The navigating event doesn't handle the flv download in this case, thats down to the flash (swf) document. The original question has changed from downloading any file with a direct link, to retrieving that link from a page that uses JavaScript/Flash player.
Re: Create Custom Download Manager for VB Webbrowser?!
Posted: Thu Mar 10, 2011 5:12 pm
by Usman55
If you want your webbrowser to download a video from a youtube url, then please check out the tutorials and downloads section. In there you will find the CNS Browser source. It uses the IE Browser control but I'm sure it will be similar. Craig also added the youtube downloader code in it.