I got something working, not sure if its the best coding way of doing it but this is how I got it to work. Here's the code if anyone else wants to do something similar.
Code:Imports System.Net Imports System.Windows.Forms Imports System.Security.Permissions Imports System.Text.RegularExpressions <PermissionSet(SecurityAction.Demand, Name:="FullTrust")> _ <System.Runtime.InteropServices.ComVisibleAttribute(True)> _ Public Class Form1 Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load WebBrowser1.ObjectForScripting = Me WebBrowser1.Navigate("http://www.mediafire.com/?syzjuytmdkn") Timer1.Enabled = True End Sub Public Sub LinkDownload() Dim linkURL As String Dim myMatches As MatchCollection Dim myRegex As New Regex("href\s*=\s*(?:""(?<1>[^""]*)""|(?<1>\S+))") linkURL = WebBrowser1.Document.GetElementById("download_link").InnerHtml myMatches = myRegex.Matches(linkURL) If myMatches.Count = 0 Then Timer1.Enabled = True Else Dim newUrl As String Dim fixUrl As String newUrl = myMatches(0).Value fixUrl = Replace(newUrl.Substring(5, newUrl.Length - 5), """", "") Process.Start(fixUrl) End If End Sub Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick Timer1.Enabled = False Call LinkDownload() End Sub End Class




Reply With Quote