<% Imports FM Imports FMLibrary.StringUtilities Imports System.ComponentModel ''' ''' Extract RapidShare Download Links ''' ''' Public Class RapidLover Public Event LinkReady(ByVal sender As RapidLover, ByVal DownloadURL As String) Private _User As String Private _URL As String Private _Password As String Private _DownloadURL As String Private _FileName As String Public Sub New() End Sub Public Sub New(ByVal URL As String, ByVal User As String, ByVal Password As String) Me.URL = URL Me.User = User Me.Password = Password End Sub Public Property FileName() As String Get Return _FileName End Get Set(ByVal value As String) _FileName = value End Set End Property Public ReadOnly Property DownloadURL() As String Get Return _DownloadURL End Get End Property Public Property Password() As String Get Return _Password End Get Set(ByVal value As String) _Password = value End Set End Property Public Property User() As String Get Return _User End Get Set(ByVal value As String) _User = value End Set End Property Public Property URL() As String Get Return _URL End Get Set(ByVal value As String) _URL = value End Set End Property ''' ''' Grab RapidShare Link ''' ''' RapidShare Download Link (then use your fuckin' download manager, don't be a communist) ''' Public Sub GetLink() Dim HTMLCode, DownloadURL As String Dim lURLLastIndexOf As Integer = URL.LastIndexOf("/") FileName = URL.Substring(lURLLastIndexOf + 1, URL.Length - lURLLastIndexOf - 1) 'Get Req (Sorry FMHTTP is not available it's big class with lots of bugs) Dim HTTPRapid As New HTTP(URL, HTTP.MethodList.POST) HTTPRapid.postData = "l=" & User & "&p=" & Password & "&hint=Service-Abuses+will+be+prosecuted%2C+80.237.244.61%21&downloadit=Download+" & FileName HTTPRapid.doRequest() HTMLCode = HTTPRapid.Code() 'Fix Link DownloadURL = ExtractText(HTMLCode, "unescape('", "')") DownloadURL = Web.HttpUtility.UrlDecode(DownloadURL) DownloadURL = ExtractText(DownloadURL, "a href=""h", """>") _DownloadURL = DownloadURL RaiseEvent LinkReady(Me, DownloadURL) End Sub End Class '// StringUtilities Module Namespace FMLibrary Public Module StringUtilities Public Module StringUtilities ''' ''' Extract text from a string ''' ''' ''' Public Function ExtractText(ByVal Code As String, ByVal TagStart As String, ByVal TagEnd As String) As String Dim posStartTag, posEndTag As Integer posStartTag = Code.IndexOf(TagStart) If posStartTag = -1 Then Return String.Empty posEndTag = Code.IndexOf(TagEnd, posStartTag + 1) If posEndTag = -1 Then Return String.Empty Return Code.Substring(posStartTag + TagStart.Length - 1, posEndTag - posStartTag - TagStart.Length + 1) End Function End Module End Namespace %>