• Earn real money by being active: Hello Guest, earn real money by simply being active on the forum — post quality content, get reactions, and help the community. Once you reach the minimum credit amount, you’ll be able to withdraw your balance directly. Learn how it works.

.NET [Function]Adf.ly Decode by fudmario[vb.net]

Status
Not open for further replies.

fudmario

Leech
User
Joined
Feb 23, 2013
Messages
202
Reputation
0
Reaction score
1,098
Points
143
Credits
0
‎12 Years of Service‎
68%
[LENGUAJE=vbnet]

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click

TextBox1.Text = AdflyUrlDecode("http://adf.ly/1NfMkS")

End Sub

[/LENGUAJE]

[LENGUAJE=vbnet]

' Return:
This link is hidden for visitors. Please Log in or register now.


[/LENGUAJE]

[HIDE-THANKS]

[LENGUAJE=vbnet]

' ***********************************************************************

' Author : fudmario

' Created : 09-15-2015

'

' Last Modified By : fudmario

' Last Modified On : 09-16-2015

' ***********************************************************************

'

' Copyright © fudmarioDev. All rights reserved.

'

'

' ***********************************************************************

Imports System.IO

Imports System.Net

Imports System.Text

Module AdflyDecode

'''

''' Decodifica una Url de Adf.ly.

'''

''' URL a decodificar.

''' Retorna la Url Decodificada.

Public Function AdflyUrlDecode(url As String) As String

Try

Dim sb As New StringBuilder

Dim data As String = GetSource(url:=url)

Dim rt As String() = {"ysmm = '", "'"c}

Dim a As Integer = data.IndexOf(rt(0), StringComparison.Ordinal) + rt(0).Length + 1

Dim b As Integer = data.Substring(a).IndexOf(rt(1), StringComparison.Ordinal) + 1

Dim s As String = Mid(data, a, b)

For i = 0 To s.Length - 1 Step 2

sb.Append(s(i))

Next

For k = s.Length - 1 To 0 Step -2

sb.Append(s(k))

Next

Return Encoding.ASCII.GetString(Convert.FromBase64String(sb.ToString())).Substring(2)

Catch ex As Exception

Return String.Empty

End Try

End Function

'''

''' Obtiene el Código Fuente de una Url.

'''

''' Url.

''' Retorna el código fuente de una Url.

Private Function GetSource(url As String) As String

Try

Return New StreamReader(WebRequest.Create(url).GetResponse().GetResponseStream()).ReadToEnd()

Catch ex As Exception

Return String.Empty

End Try

End Function

End Module

[/LENGUAJE][/HIDE-THANKS]

 
Status
Not open for further replies.
Back
Top