logo logo

The next-generation blog, news, and magazine theme for you to start sharing your stories today!

The Blogzine

Save on Premium Membership

Get the insights report trusted by experts around the globe. Become a Member Today!

View pricing plans

New York, USA (HQ)

750 Sing Sing Rd, Horseheads, NY, 14845

Call: 469-537-2410 (Toll-free)

hello@blogzine.com
.Net

[VB.Net] How to direct link Mediafire.Com

Lưu ý : Đây là code VB.Net ( Mình dùng VB2010) Như hình bên trên bạn thêm : 2 Textbox, 1 Button, 1 Label Bước 1 : Các bạn phải import 2 lệnh này vào Imports System.Net Imports System.IO Bước 2 : Ti…

avatar
Hung.Pro.VN

Developer Windows


  • 20/04/2016
  • Views

Lưu ý : Đây là code VB.Net ( Mình dùng VB2010)






Như hình bên trên bạn thêm : 2 Textbox, 1 Button, 1 Label

Bước 1: Các bạn phải import 2 lệnh này vào

Imports System.Net
Imports System.IO

Bước 2: Tiếp đó các bạn thêm đoạn code sau vào

Function GetLink(ByVal MediafireURL As String) As String
If MediafireURL.StartsWith("www") Then MediafireURL = "http:\\" & MediafireURL
Dim Req As HttpWebRequest = DirectCast(WebRequest.Create(MediafireURL), HttpWebRequest)
Req.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10"
Req.Method = "GET"
Req.AllowAutoRedirect = False
Dim Response As HttpWebResponse = Req.GetResponse
Dim S As New StreamReader(Response.GetResponseStream)
Dim Pageresult As String = S.ReadToEnd
If Pageresult.Contains("kNO") Then
Return WebUtility.HtmlDecode(ParseBetween(Pageresult, "kNO = """, """", "kNO = """.Length))
Else
Return "Not Found"
End If
End Function

Public Function ParseBetween(ByVal Html As String, ByVal Before As String, ByVal After As String, ByVal Offset As Integer) As String
If String.IsNullOrEmpty(Html) Then Return String.Empty
If Html.Contains(Before) Then
Dim Result As String = Html.Substring(Html.IndexOf(Before) + Offset)
If Result.Contains(After) AndAlso Not String.IsNullOrEmpty(After) Then Result = Result.Substring(0, Result.IndexOf(After))
Return Result
Else
Return String.Empty
End If
End Function

Đây là đoạn fuction để getlink từ mediafire.com cũng khá khó hiểu cho một số bạn
.
Bước 3: Các bạn kick vào button và thêm đoạn code sau

TextBox1.Text = GetLink(MfInLinkTb.Text)

Đây là đoạn code để gọi và đưa ra link cho bạn

Hiện tại ứng dụng mình chưa viết ra nhé

Related post


avatar

Hung.Pro.VN

Nhà thiết kế Web
View Articles

Tôi là admin trang Hung.Pro.VN là một người có đam mê với Blogspot, kinh nghiệm 5 năm thiết kế ra hàng trăm mẫu Template blogpsot như" Bán hàng, bất động sản, landing page, tin tức...

Nhận xét

Share this article