Youtube linkini gösteren addon

Yabancı bir forumda buldum . /yt paint yada /yt fenerbahçe yazınca o kelimedeki ilk videonun linkini yolluyor .

PHP- Kodu:
; youtube video search
; returns the first search result for your search terms
; usage for you
;
; 
trigger: /yt
; syntax: /yt <search terms>
; 
example: /yt charleston daft punk
; usage for other people
;
; 
triggers: !youtube @youtube !tube @tube
; syntax: @youtube <search terms>
; 
example: !tube charleston daft punk

; if you want to sort search by VIEW COUNT, use this line below
; sockwrite -nt $sockname GET /results?search_sort=video_view_count&search_query= $+ %searchstring
;
; if 
you want the regular search, use this line below
; sockwrite -nt $sockname GET /results?search_query= $+ %searchstring HTTP//1.1
;
; 
the place im referring to is: under the heading on *:sockopen:ytsearch:{
alias yt {
  %
channel = $chan
  
if (%channel) { %saystyle = echo -t %channel }
  else { %
saystyle = echo -at }
  %
searchstring = $replace($1-,$chr(32),+)
  
sockclose ytsearch
  sockopen ytsearch www
.youtube.com 80
}
on $*:TEXT:/^[!@](yt|youtube|tube) */Si:#: { 
  
%channel = $chan
  
%saystyle = /msg %channel
  
%searchstring = $replace($2-,$chr(32),+)
  if ($
2 == $null) { %saystyle Search could not be completed | halt }
  
sockclose ytsearch
  sockopen ytsearch www
.youtube.com 80
}
on *:sockopen:ytsearch:{
  
sockwrite -nt $sockname GET /results?search_query= $+ %searchstring HTTP//1.1
  
sockwrite -nt $sockname Host: youtube.com 
  sockwrite 
-nt $sockname $crlf $crlf 
}
on *:sockread:ytsearch:{
  
sockread -n %temp
  
if (%founddesc_be) { unset %founddesc_be | %desc_be = $replace($remove(%temp, ),<br/>,$chr(32)) }
  if (<
span id="BeginvidDesc isin %temp) %founddesc_be = k
  if (/watch?v= isin %temp) { %resulturl = $remove($gettok(%temp,2,32),href="
,") }
  if (%foundtitle) { inc %titlecounter }
  if (%titlecounter = 1) { %searchtitle = $replace($remove($regsubex(%temp,/<a [^>]+>(.+?)</a>/,\1),<br/>, ),&quot;,$chr(34)) }
  if (<div class="
vtitle"> isin %temp) { %foundtitle = k | %titlecounter = 0 }
  if (<img class="
rating" src="/img/icn_star_full_19x20 isin %temp) { %done = k }
  if (%
done) {
    
sockclose ytsearch
    
unset %done
    
%saystyle Link: http://www.youtube.com $+ %resulturl
    
%saystyle Title: %searchtitle
    
%saystyle Description: %desc_be
    
unset %searchstring
    
unset %channel
    
unset %saystyle
    
unset %searchres
    
unset %searchtitle
    
unset %resulturl
    
unset %desc_be
    
unset %titlecounter
    
unset %temp
    
unset %foundtitle
    halt
  
}
  if (*
No Videos found* iswm %temp) {
    
sockclose ytsearch
    
%saystyle No videos found for %searchstring
    
unset %searchstring
    
unset %channel
    
unset %saystyle
    
unset %searchres
    
unset %searchtitle
    
unset %resulturl
    
unset %desc_be
    
unset %titlecounter
    
unset %temp
    
unset %foundtitle
    halt
  
}
  if (*
start search results* iswm %temp) { %searchres = 0 }  
  if (*<
a href="/watch?v=* iswm %temp) { inc %searchres }
} 

Yorumlar

Bir yanıt yazın