Create Custom Download Manager for VB Webbrowser?!

Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
36 posts Page 3 of 4
Contributors
User avatar
Napster1488
VIP - Donator
VIP - Donator
Posts: 524
Joined: Fri Jan 07, 2011 8:41 pm

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 all
IF 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?!
YouTube Downloader v3.0
Image
Image
Image
User avatar
Usman55
VIP - Site Partner
VIP - Site Partner
Posts: 2821
Joined: Thu Dec 24, 2009 7:52 pm

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.
Image
User avatar
Napster1488
VIP - Donator
VIP - Donator
Posts: 524
Joined: Fri Jan 07, 2011 8:41 pm

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
YouTube Downloader v3.0
Image
Image
Image
User avatar
Napster1488
VIP - Donator
VIP - Donator
Posts: 524
Joined: Fri Jan 07, 2011 8:41 pm

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 all
If 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 all
javascript: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 ?
YouTube Downloader v3.0
Image
Image
Image
User avatar
Usman55
VIP - Site Partner
VIP - Site Partner
Posts: 2821
Joined: Thu Dec 24, 2009 7:52 pm

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.
Image
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

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.
User avatar
Napster1488
VIP - Donator
VIP - Donator
Posts: 524
Joined: Fri Jan 07, 2011 8:41 pm

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 all
textbox1.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.
YouTube Downloader v3.0
Image
Image
Image
User avatar
Usman55
VIP - Site Partner
VIP - Site Partner
Posts: 2821
Joined: Thu Dec 24, 2009 7:52 pm

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.
Image
User avatar
mandai
Coding God
Coding God
Posts: 2585
Joined: Mon Apr 26, 2010 6:51 pm

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.
User avatar
Usman55
VIP - Site Partner
VIP - Site Partner
Posts: 2821
Joined: Thu Dec 24, 2009 7:52 pm

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.
Image
36 posts Page 3 of 4
Return to “Tutorial Requests”