Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias xconnection { set %tmpx $remove($1,http://,youtube,.com,www.) | sockopen youtube youtube.com 80 }
- on *:SOCKOPEN:youtube:{
- sockwrite -n $sockname GET %tmpx HTTP/1.1
- sockwrite -n $sockname Host: www.youtube.com
- sockwrite -n $sockname User-Agent: IRCSpider/mIRC $version
- sockwrite -n $sockname Accept: *.*, */*
- sockwrite -n $sockname Referer: $server
- sockwrite -n $sockname Connection: Keep-Alive
- sockwrite -n $sockname Content-Type: text/html
- sockwrite -n $sockname $crlf
- }
- on *:SOCKREAD:youtube:{
- sockread %mirc.temp
- tokenize 32 %mirc.temp
- if (!$window(@YouTube)) { window -a @YouTube }
- if ($1) { echo -g @YouTube $1- }
- if (<meta name="title" content=" isin %mirc.temp) { set %youtube.title $remove(%mirc.temp,$chr(9),<meta name="title" content=",">) }
- if (<strong class="watch-view-count">*</strong><br>views iswm %mirc.temp) { echo -ag $1- | set %youtube.views $remove($ifmatch,<strong class="watch-view-count">,</strong><br>views) }
- if (%youtube.title) { msg %tmp.chan 01,0You0,4Tube4:14 %youtube.title $chr(124) Views - %youtube.views $chr(124) Popularity - %youtibe.likes / %youtube.dislikes $chr(124) | sockclose youtube }
- }
- on *:SOCKCLOSE:youtube:{ /noop }
- on *:TEXT:*:#:{
- set %tmp.chan $chan
- unset %d
- var %str = $gettok($1-,0,32)
- while (%str) {
- var %link = $gettok($1-,%str,32)
- if (youtube.com/watch?v= isin %link) { sockclose youtube | xconnection %link | clear @YouTube | halt }
- dec %str
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement