Click here to Skip to main content
14,921,745 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi all

I have one problem with my code below, I try to write the program to get web source code from website which I want to select only one code inside of website source code address ( select from "https://edge" until ".m3u8"). I found that i only error to find the web source code i need.

if someone who know the answer how to do, pls share me code.

What I have tried:

    Private Function GetAddressSteaming() As String
        Dim Str As String
        Dim a As String
        Dim modelHtml
        Dim SourceCode As String

        On Error GoTo ErrorExit
        SourceCode = New System.Net.WebClient().DownloadString(cbAddress.Text)
        txtSourCode.Text = SourceCode

        modelHtml = SourceCode

        'Format Address
        modelHtml = modelHtml.left(modelHtml, InStr(modelHtml, ".m3u8") + 4)
        modelHtml = modelHtml.Right(modelHtml, Len(modelHtml) - InStr(modelHtml, "https://edge") + 1)
        If Len(modelHtml) < 20 Then
            modelHtml = ""
            MsgBox("Sorry, is offline or does not exist!")
        End If
        a = modelHtml
        Str = a.Replace("/live\u002Dhls/", "/live-hls/")
        Str = Str.Replace("\u002Dhls/", "")
        Str = Str.Replace("\u002D", "-")

        information.Text = Str

ErrorExit:
    End Function
Posted
Updated 30-Apr-21 3:28am

1 solution

Private Function GetAddressSteaming() As String
        Dim Str As String
        Dim a As String
        Dim modelHtml
        Dim SourceCode As String

        On Error GoTo ErrorExit
        SourceCode = New System.Net.WebClient().DownloadString(cbAddress.Text)
        txtSourCode.Text = SourceCode

        modelHtml = SourceCode

        modelHtml = modelHtml.left(modelHtml, InStr(modelHtml, ".m3u8") + 4)
        modelHtml = modelHtml.Right(modelHtml, Len(modelHtml) - InStr(modelHtml, "https://edge") + 1)
        If Len(modelHtml) < 20 Then
            modelHtml = ""
            MsgBox("Sorry, is offline or does not exist!")
        End If
        a = modelHtml
        Str = a.Replace("/live\u002Dhls/", "/live-hls/")
        Str = Str.Replace("\u002Dhls/", "")
        Str = Str.Replace("\u002D", "-")

        information.Text = Str

ErrorExit:
    End Function
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900