Dies ist eine alte Version des Dokuments!


Youtube Info

#NewScriptBegin YoutubeInfo
 
Dim MyConn
Dim VideoID
Dim VideoTitle
Dim DescrStart
 
Sub Chan_Msg(Text, Nick, Channel, FrameID, ConnID)
  if InStr(1, Text, "youtube.com/watch?") > 0 then
    CheckVideo Text
  end if
End Sub
 
Sub SendMsg(Text, Channel, FrameID, ConnID)
  if InStr(1, Text, "youtube.com/watch?") > 0 then
    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)
      Print "~ Video-title: ", 0, valcClientMsg
      Print DecodeUTF8(VideoTitle), 0, 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
        Print "~ Video-description: ", 0, valcClientMsg
        Print DecodeUTF8(Text), 0, valcText, 1
      end if
    end if
  End if
End Sub

Eigene Werkzeuge