2017-10-10 1 views
-2

Gibt es eine Möglichkeit, alle Header von Web-Browser-Controller zu sammeln? Ich muss nach einem Header suchen und die vollständige URL daraus abrufen. Hier können Sie sehen, was ich in VIDEO bedeuten, dass ich für euch hochgeladen:VB.NET Visual Basic Header Reader

YouTube Vid

ich etwas brauche alle XRH Headers zu sammeln und dann kann ich meine Sachen tun. Ich benutze VB.NET VB 2017/2015.

+0

Willkommen bei Stack-Überlauf. Bitte lesen Sie http://stackoverflow.com/help/how-to-ask und http://stackoverflow.com/help/mcve –

+0

_ "Fragen, die uns bitten, ** ein Buch, ein Tool, eine Softwarebibliothek oder ein Tutorial zu empfehlen oder zu finden oder andere Off-Site-Ressourcen ** sind off-topic für Stack Overflow, da sie dazu neigen, eigensinnige Antworten und Spam zu bekommen. Stattdessen [beschreiben Sie das Problem] (http://meta.stackexchange.com/q/139399/) und was wurde bisher gemacht, um es zu lösen. "_ - Von [On-topic] (https://stackoverflow.com/help/on-topic). –

+0

Die meisten Leute sehen kein Video, um zu sehen, was das Problem ist - bitte fügen Sie alle notwendigen Informationen in die Frage selbst ein. Text ist ideal und fügt nach Bedarf Standbilder hinzu. Vielen Dank! Wenn Sie erweitern können, was ein "XRH Header" ist, wäre das gut. Ist es eine bestimmte Art von HTTP-Anfrage oder Antwort-Header? – halfer

Antwort

1

Ok ich dachte es von mir selbst ... Ich habe eine Zeit ... Wenn jemand etwas sucht das gleiche hier ist endlich Code, was ich tat und wie.

Imports System.Text.RegularExpressions 

Public Class Form1

Dim URL_ID As String = "" 
Dim URL_PlaylistSource = "" 
Dim URL_chunklist_ As String = "" 
Dim FULL_URL_TO_VIDEO As String = "" 
Dim URL_FOR_FIRST_PART_OF_FILE_GENERATOR As String = "" 
Dim FileToSaveAndOpen As String = "C:/Users/Silver Lab/Desktop/TVplayUrlGenerator.m3u8" 

'/////////// Drag Form 
Private IsDragging As Boolean = False 
Private StartPoint As Point 

Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox_background.MouseDown 
    StartPoint = PictureBox_background.PointToScreen(New Point(e.X, e.Y)) 
    IsDragging = True 
End Sub 

Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox_background.MouseMove 
    If IsDragging Then 
     Dim EndPoint As Point = PictureBox_background.PointToScreen(New Point(e.X, e.Y)) 
     Me.Left += (EndPoint.X - StartPoint.X) 
     Me.Top += (EndPoint.Y - StartPoint.Y) 
     StartPoint = EndPoint 
    End If 
End Sub 

Private Sub PictureBox_background_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles PictureBox_background.MouseUp 
    IsDragging = False 
End Sub 
'/////////// END Drag Form /////////// 


'///////////// 
Public Sub ReadStreamSource(ByVal URL As String) 
    Dim StreamSource As String = New System.Net.WebClient().DownloadString(URL) 
    TextBox_SourceCollector.Text = StreamSource 
End Sub 

Private Sub Timer_reader_Tick(sender As Object, e As EventArgs) Handles Timer_reader.Tick 
    If Label_process_ID.Text = 1 Then 
     Timer_reader.Stop() 
     ProgressBar_Process.Value = 15 
     ProgressBar_Process.Visible = True 
     ReadStreamSource("https://playapi.mtgx.tv/v3/videos/stream/" + URL_ID) 

     Exit Sub 
    End If 
    '////////////// 
    If Label_process_ID.Text = 2 Then 
     Timer_reader.Stop() 
     ProgressBar_Process.Value = 39 
     Dim CleanURL As String = TextBox_SourceCollector.Text.Replace("\", "") 
     TextBox_SourceCollector.Text = CleanURL 
     '\\\ 
     Dim regex As Regex = New Regex("https://mtglva010.cloudycdn.services/vod.*./playlist.m3u8") 
     Dim match As Match = regex.Match(CleanURL) 

     If match.Success Then 
      Dim split = match.Value.Split("""") 
      URL_PlaylistSource = split(6) 
      Label_process_ID.Text = Val(3) 
      ReadStreamSource(URL_PlaylistSource) 
     End If 

     Exit Sub 
    End If 
    '////////////// 
    If Label_process_ID.Text = 3 Then 
     Timer_reader.Stop() 
     ProgressBar_Process.Value = 49 
     Dim regex As Regex = New Regex("chunklist_.*m3u8") 
     Dim match As Match = regex.Match(TextBox_SourceCollector.Text) 
     If match.Success Then 
      Label_process_ID.Text = Val(4) 
      URL_chunklist_ = match.Value 
     End If 

     Exit Sub 
    End If 
    '////////////// 
    If Label_process_ID.Text = 4 Then 
     Timer_reader.Stop() 
     ProgressBar_Process.Value = 72 
     Dim regex As Regex = New Regex("https://mtglva010.cloudycdn.services/vod/_definst_.*smil") 
     Dim match As Match = regex.Match(URL_PlaylistSource) 
     If match.Success Then 
      FULL_URL_TO_VIDEO = match.Value & "/" & URL_chunklist_ 
      ReadStreamSource(FULL_URL_TO_VIDEO) 
      URL_FOR_FIRST_PART_OF_FILE_GENERATOR = match.Value & "/media" 
     End If 
     Exit Sub 
    End If 
    '////////////// 
    If Label_process_ID.Text = 5 Then 
     Timer_reader.Stop() 
     ProgressBar_Process.Value = 100 
     Dim GeneratedChunkLIST As String = TextBox_SourceCollector.Text.Replace("media", URL_FOR_FIRST_PART_OF_FILE_GENERATOR) 
     TextBox_SourceCollector.Text = GeneratedChunkLIST 
     Dim ReplaceVersion As String = TextBox_SourceCollector.Text.Replace("#EXT-X-VERSION:4", "#EXT-X-VERSION:3") 
     TextBox_SourceCollector.Text = ReplaceVersion 
     Label_process_ID.Text = Val(0) 
     '///// Save To File 
     Dim myText As String = TextBox_SourceCollector.Text 
     Dim myFile As IO.File 
     Dim SW As IO.StreamWriter 
     SW = myFile.AppendText(FileToSaveAndOpen) 
     SW.Write(myText) 
     SW.Close() 

     My.Computer.Audio.PlaySystemSound(System.Media.SystemSounds.Hand) 
     If MsgBox("File generated on your Desktop Sucessfully" & vbNewLine & "Do You want to Open it?", MsgBoxStyle.YesNo, "Generated Sucessfully.") = MsgBoxResult.Yes Then 
      Process.Start(FileToSaveAndOpen) 
     End If 
     ProgressBar_Process.Visible = False 
     ProgressBar_Process.Value = 0 
    End If 

End Sub 
Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox_SourceCollector.TextChanged 
    If TextBox_SourceCollector.Text.Contains("streams") Then 
     Label_process_ID.Text = Val(2) 
    End If 

    If TextBox_SourceCollector.Text.Contains("chunklist_") Then 
     Label_process_ID.Text = Val(3) 
    End If 

    If TextBox_SourceCollector.Text.Contains("media") Then 
     Label_process_ID.Text = Val(5) 
    End If 
End Sub 

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load 
    Label_process_ID.Text = Val(0) 
    TextBox_InputURL.TabStop = True 
    ProgressBar_Process.Value = 0 
    ProgressBar_Process.Visible = False 
End Sub 

Private Sub TextBox_InputURL_DoubleClick(sender As Object, e As EventArgs) Handles TextBox_InputURL.DoubleClick 
    TextBox_InputURL.SelectAll() 
End Sub 

Private Sub TextBox_InputURL_TextChanged(sender As Object, e As EventArgs) Handles TextBox_InputURL.TextChanged 
    If TextBox_InputURL.Text = Nothing Then 
     PictureBox_ProcessButton.Image = My.Resources.Search_Disable_fw 
     PictureBox_ProcessButton.Cursor = Cursors.Default 
    Else 
     PictureBox_ProcessButton.Image = My.Resources.Search_Enable_fw 
     PictureBox_ProcessButton.Cursor = Cursors.Hand 
    End If 
End Sub 

Private Sub PictureBox_ProcessButton_Click(sender As Object, e As EventArgs) Handles PictureBox_ProcessButton.Click 
    If My.Computer.FileSystem.FileExists(FileToSaveAndOpen) Then 
     My.Computer.FileSystem.DeleteFile(FileToSaveAndOpen) 
    End If 
    If PictureBox_ProcessButton.Cursor = Cursors.Hand Then 
     Timer_countDown.Start() 
     Dim regex As Regex = New Regex("\d+") 
     Dim match As Match = regex.Match(TextBox_InputURL.Text) 
     If match.Success Then 
      URL_ID = (match.Value) 
      Label_URL_ID.Text = URL_ID 
      Label_process_ID.Text = Val(1) 
     End If 
    End If 
End Sub 

Private Sub Timer_countDown_Tick(sender As Object, e As EventArgs) Handles Timer_countDown.Tick 

    If Label_CountDown.Text = 0 Then 
      Timer_reader.Start() 
      Timer_countDown.Stop() 
     Label_CountDown.Text = 1 
    Else 
      Label_CountDown.Text = Label_CountDown.Text - 1 
     End If 

End Sub 
Private Sub Label_process_ID_TextChanged(sender As Object, e As EventArgs) Handles Label_process_ID.TextChanged 
    Timer_countDown.Start() 
End Sub 

Private Sub PictureBox_Exit_MouseLeave(sender As Object, e As EventArgs) Handles PictureBox_Exit.MouseLeave 
    PictureBox_Exit.Image = Nothing 
End Sub 

Private Sub PictureBox_Exit_MouseMove(sender As Object, e As MouseEventArgs) Handles PictureBox_Exit.MouseMove 
    PictureBox_Exit.Image = My.Resources.Exit_over_fw 
End Sub 

Private Sub PictureBox_minimize_MouseLeave(sender As Object, e As EventArgs) Handles PictureBox_minimize.MouseLeave 
    PictureBox_minimize.Image = Nothing 
End Sub 

Private Sub PictureBox_minimize_MouseMove(sender As Object, e As MouseEventArgs) Handles PictureBox_minimize.MouseMove 
    PictureBox_minimize.Image = My.Resources.min_over_fw 
End Sub 

Private Sub PictureBox_Exit_Click(sender As Object, e As EventArgs) Handles PictureBox_Exit.Click 
    Application.Exit() 
End Sub 

Private Sub PictureBox_minimize_Click(sender As Object, e As EventArgs) Handles PictureBox_minimize.Click 
    Me.WindowState = FormWindowState.Minimized 
End Sub 

Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked 
    Process.Start("https://www.facebook.com/awp3le") 
End Sub 

Private Sub LinkLabel2_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel2.LinkClicked 
    Process.Start("https://www.youtube.com/user/SilverLabETC/featured?view_as=subscriber") 
End Sub 

End Class