Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen gezeigt.

Link zu dieser Vergleichsansicht

nettalk:scripting:youtubeinfo [2010/04/18 22:22]
mirici
nettalk:scripting:youtubeinfo [2010/04/18 22:39] (aktuell)
mirici
Zeile 1: Zeile 1:
 ====== Youtube Info ====== ====== Youtube Info ======
 +Nur im eigenen Client anzeigen
 <code vb> <code vb>
 #​NewScriptBegin YoutubeInfo #​NewScriptBegin YoutubeInfo
 + 
 Dim MyConn Dim MyConn
 Dim VideoID Dim VideoID
 Dim VideoTitle Dim VideoTitle
 Dim DescrStart Dim DescrStart
 +Dim CurrFrame 
 + 
 Sub Chan_Msg(Text,​ Nick, Channel, FrameID, ConnID) Sub Chan_Msg(Text,​ Nick, Channel, FrameID, ConnID)
   if InStr(1, Text, "​youtube.com/​watch?"​) > 0 then   if InStr(1, Text, "​youtube.com/​watch?"​) > 0 then
 +    CurrFrame = FrameID
     CheckVideo Text     CheckVideo Text
   end if   end if
 End Sub End Sub
 + 
 Sub SendMsg(Text,​ Channel, FrameID, ConnID) Sub SendMsg(Text,​ Channel, FrameID, ConnID)
   if InStr(1, Text, "​youtube.com/​watch?"​) > 0 then   if InStr(1, Text, "​youtube.com/​watch?"​) > 0 then
 +    CurrFrame = FrameID
     CheckVideo Text     CheckVideo Text
   end if   end if
 End Sub End Sub
 + 
 Sub CheckVideo(URL) Sub CheckVideo(URL)
   i = InStr(1, URL, "?​v="​)   i = InStr(1, URL, "?​v="​)
Zeile 27: Zeile 31:
   MyConn=dccconnect("​m.youtube.com",​80,"","",​0,​1)   MyConn=dccconnect("​m.youtube.com",​80,"","",​0,​1)
 End Sub End Sub
 + 
 Sub Serv_Connected(ConnID) Sub Serv_Connected(ConnID)
   if ConnID = MyConn Then   if ConnID = MyConn Then
Zeile 36: Zeile 40:
   End if   End if
 End Sub 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
 +</​code>​
  
 +Allen im Channel anzeigen
 +
 +<code vb>
 +#​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) Sub RecvDCCMsg(Text,​ Nick, FrameID, ConnID)
   if ConnID = MyConn Then   if ConnID = MyConn Then
Zeile 43: Zeile 119:
       iEnd = InStr(1, Text, "</"​)       iEnd = InStr(1, Text, "</"​)
       VideoTitle = Mid(Text, iStart + 17, iEnd - iStart - 17)       VideoTitle = Mid(Text, iStart + 17, iEnd - iStart - 17)
-      Print "~ Video-title:​ ", ​0, valcClientMsg +      ​Send "​Video-title:​ " & DecodeUTF8(VideoTitle),​ CurrFrame 
-      Print DecodeUTF8(VideoTitle), ​0, valcText, 1+      'Print "~ Video-title:​ ", ​CurrFrame, valcClientMsg 
 +      ​'Print DecodeUTF8(VideoTitle), ​CurrFrame, valcText, 1
     End if     End if
-    ​+ 
     if Text = "</​span></​div>"​ then     if Text = "</​span></​div>"​ then
       DescrStart = 0       DescrStart = 0
Zeile 52: Zeile 129:
       MyConn = 0       MyConn = 0
     end if     end if
-    ​+ 
     if Text = "<​div><​span>"​ then     if Text = "<​div><​span>"​ then
       DescrStart = 1       DescrStart = 1
     else     else
       if DescrStart = 1 then       if DescrStart = 1 then
-        Print "~ Video-description:​ ", ​0, valcClientMsg +        ​Send "​Video-description:​ " & DecodeUTF8(Text),​ CurrFrame 
-        Print DecodeUTF8(Text), ​0, valcText, 1+        'Print "~ Video-description:​ ", ​CurrFrame, valcClientMsg 
 +        ​'Print DecodeUTF8(Text), ​CurrFrame, valcText, 1
       end if       end if
     end if     end if

Eigene Werkzeuge