Youtube Info

Nur im eigenen Client anzeigen

#NewScriptBegin YoutubeInfo
 
Dim MyConn
Dim VideoID
Dim VideoTitle
Dim DescrStart
Dim CurrFrame
 
Sub Chan_Msg(Text, Nick, Channel, FrameID, ConnID)
  if InStr(1, Text, "youtube.com/watch?") > 0 then
    CurrFrame = FrameID
    CheckVideo Text
  end if
End Sub
 
Sub SendMsg(Text, Channel, FrameID, ConnID)
  if InStr(1, Text, "youtube.com/watch?") > 0 then
    CurrFrame = FrameID
    CheckVideo Text
  end if
End Sub
 
Sub CheckVideo(URL)
  i = InStr(1, URL, "?v=")
  DescrStart = 0
  VideoID = Mid(URL, i+3)
  Print "~ Check Video " & VideoID & "...", 0, valcClientMsg
  MyConn=dccconnect("m.youtube.com",80,"","",0,1)
End Sub
 
Sub Serv_Connected(ConnID)
  if ConnID = MyConn Then
    SendData "GET /watch?v=" & VideoID & "&fulldescription=1" & " HTTP/1.0", ConnID
    SendData "Host: m.youtube.com", ConnID
    SendData "Connection: Close" + chr(13) + chr(10), ConnID
    isOut=0
  End if
End Sub
 
Sub RecvDCCMsg(Text, Nick, FrameID, ConnID)
  if ConnID = MyConn Then
    iStart = InStr(1, Text, "<title>YouTube - ")
    if iStart > 0 then
      iEnd = InStr(1, Text, "</")
      VideoTitle = Mid(Text, iStart + 17, iEnd - iStart - 17)
      'Send "Video-title: " & DecodeUTF8(VideoTitle), CurrFrame
      Print "~ Video-title: ", CurrFrame, valcClientMsg
      Print DecodeUTF8(VideoTitle), CurrFrame, valcText, 1
    End if
 
    if Text = "</span></div>" then
      DescrStart = 0
      closeconn ConnID
      MyConn = 0
    end if
 
    if Text = "<div><span>" then
      DescrStart = 1
    else
      if DescrStart = 1 then
        'Send "Video-description: " & DecodeUTF8(Text), CurrFrame
        Print "~ Video-description: ", CurrFrame, valcClientMsg
        Print DecodeUTF8(Text), CurrFrame, valcText, 1
      end if
    end if
  End if
End Sub

Allen im Channel anzeigen

#NewScriptBegin YoutubeInfo
 
Dim MyConn
Dim VideoID
Dim VideoTitle
Dim DescrStart
Dim CurrFrame
 
Sub Chan_Msg(Text, Nick, Channel, FrameID, ConnID)
  if InStr(1, Text, "youtube.com/watch?") > 0 then
    CurrFrame = FrameID
    CheckVideo Text
  end if
End Sub
 
Sub SendMsg(Text, Channel, FrameID, ConnID)
  if InStr(1, Text, "youtube.com/watch?") > 0 then
    CurrFrame = FrameID
    CheckVideo Text
  end if
End Sub
 
Sub CheckVideo(URL)
  i = InStr(1, URL, "?v=")
  DescrStart = 0
  VideoID = Mid(URL, i+3)
  Print "~ Check Video " & VideoID & "...", 0, valcClientMsg
  MyConn=dccconnect("m.youtube.com",80,"","",0,1)
End Sub
 
Sub Serv_Connected(ConnID)
  if ConnID = MyConn Then
    SendData "GET /watch?v=" & VideoID & "&fulldescription=1" & " HTTP/1.0", ConnID
    SendData "Host: m.youtube.com", ConnID
    SendData "Connection: Close" + chr(13) + chr(10), ConnID
    isOut=0
  End if
End Sub
 
Sub RecvDCCMsg(Text, Nick, FrameID, ConnID)
  if ConnID = MyConn Then
    iStart = InStr(1, Text, "<title>YouTube - ")
    if iStart > 0 then
      iEnd = InStr(1, Text, "</")
      VideoTitle = Mid(Text, iStart + 17, iEnd - iStart - 17)
      Send "Video-title: " & DecodeUTF8(VideoTitle), CurrFrame
      'Print "~ Video-title: ", CurrFrame, valcClientMsg
      'Print DecodeUTF8(VideoTitle), CurrFrame, valcText, 1
    End if
 
    if Text = "</span></div>" then
      DescrStart = 0
      closeconn ConnID
      MyConn = 0
    end if
 
    if Text = "<div><span>" then
      DescrStart = 1
    else
      if DescrStart = 1 then
        Send "Video-description: " & DecodeUTF8(Text), CurrFrame
        'Print "~ Video-description: ", CurrFrame, valcClientMsg
        'Print DecodeUTF8(Text), CurrFrame, valcText, 1
      end if
    end if
  End if
End Sub

Eigene Werkzeuge