Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;YouTube Script (Parse Vids and Search) v2.2
- ;Made by nick1
- ;Last edit June 2 2011
- raw 408:*: msg $2 $remove($strip($13-),$chr(9))
- on $*:text:/^[!@]y(outube|t|tsearch|search|ousearch|outubesearch)/Si:*:{
- if ($($+(%,botflood.,$nick),2)) {
- if ($($+(%,botflood.,$nick),2) >= 50) { ignore -u60 $address($nick,0) | msg $chan $+($nick,$chr(44)) You Have Been Put On Ignore For 60secs For Abusing The Bot. | halt }
- elseif ($($+(%,botflood.,$nick),2) >= 40) { msg $chan $+($nick,$chr(44)) Please Do Not Abuse The Bot. | inc -z $+(%,botflood.,$nick) 20 | halt }
- else { inc -z $+(%,botflood.,$nick) 25 }
- }
- else { inc -z $+(%,botflood.,$nick) 25 }
- var %ticks $ticks
- if ($2) {
- set $+(%,ysearch.,%ticks,.msgtype) $iif($left($strip($1),1) == @,msg $chan,notice $nick)
- set $+(%,ysearch.,%ticks,.search) $replace($2-,$chr(32),+)
- sockopen $+(ysearch.,%ticks) youtube.com 80
- }
- elseif ($2 == $null) { msg $chan $+(4,$nick,,$chr(44)) 10Incorrect Syntax: Try ! or @ 4YOUTUBE10 <search term> }
- }
- on *:input:*:{
- if (($remove($1,$left($strip($1),1)) == ysearch) || ($remove($1,$left($strip($1),1)) == ytsearch) || ($remove($1,$left($strip($1),1)) == yt) || ($remove($1,$left($strip($1),1)) == youtube) || ($remove($1,$left($strip($1),1)) == youtubesearch)) {
- set $+(%,ysearch.,$ticks,.msgtype) msg $active
- set $+(%,ysearch.,$ticks,.search) $replace($2-,$chr(32),+)
- sockopen $+(ysearch.,$ticks) youtube.com 80
- }
- elseif (*youtube.com* iswm $1-) {
- set %i 1
- while (%i <= $numtok($1-,32)) {
- if ((*youtube.com* iswm $($+($,%i),2)) || (*youtu.be* iswm $($+($,%i),2))) {
- set $+(%,youtube.,$ticks,.url) $($+($,%i),2)
- set $+(%,youtube.,$ticks,.tag) $remove($strip($($+($,%i),2)),http://,www.,youtube.com,youtu.be/,/watch?v=,$chr(31))
- }
- inc %i
- }
- set $+(%,youtube.,$ticks,.msgtype) msg $active
- set $+(%,youtube.,$ticks,.nick) $nick
- set $+(%,youtube.,$ticks,.chan) $chan
- set $+(%,youtube.,$ticks,.network) $network
- sockopen $+(youtube.,$ticks) youtube.com 80
- }
- elseif (($1 == !youtubelinks) || ($1 == !youtubefetch) || ($1 == !youtube)) {
- set %youtubefetch $addtok(%youtubefetch,$iif(($2),$2,$chan),44)
- echo -ac info I will message $iif(($2),$2,$chan) with youtube info...
- }
- elseif (($1 == !noyoutubelinks) || ($1 == !noyoutubefetch) || ($1 == !noyoutube)) {
- set %youtubefetch $remtok(%youtubefetch,$iif(($2),$2,$chan),44)
- echo -ac info I wont message $iif(($2),$2,$chan) with youtube info...
- }
- }
- alias checkifsockopen {
- if ($sock(%checksockname)) { sockclose %checksockname
- if (%youtube.msgtype) %youtube.msgtype $+(12[4,YOUTUBE,12])10 Error Encountered! | unset %youtube.*
- }
- }
- on *:sockopen:ysearch*: {
- set %checksockname $sockname
- .timerCheck 1 5 checkifsockopen
- sockwrite -nt $sockname GET /results?search_query= $+ $($+(%,ysearch.,$remove($sockname,ysearch.),.search),2) HTTP/1.1
- sockwrite -nt $sockname Host: www.youtube.com
- sockwrite -nt $sockname $crlf
- }
- alias nohtml { return $regsubex($$1-,/^[^<]*>|<[^>]*>|<[^>]*$/g,) }
- on *:SOCKREAD:ysearch*: {
- if ($sockerr) { echo -a SOCKET ERROR: $sockerr | halt }
- sockread %sockreader
- if (*<h3>* iswm %sockreader) {
- set $+(%,ysearch.,$remove($sockname,ysearch.),.title) $regsubex($nohtml($replace($remove(%sockreader,|),<b>,,</b>,,",",&,&)),/&#(\d\d?\d?\d?);/g,$chr(\1))
- tokenize 34 %sockreader
- set $+(%,ysearch.,$remove($sockname,ysearch.),.tag) $2
- }
- elseif (*</div><h3* iswm %sockreader) {
- set $+(%,ysearch.,$remove($sockname,ysearch.),.title) $regsubex($nohtml($replace($remove(%sockreader,|),<b>,,</b>,,",",&,&)),/&#(\d\d?\d?\d?);/g,$chr(\1))
- tokenize 34 %sockreader
- set $+(%,ysearch.,$remove($sockname,ysearch.),.tag) $4
- }
- elseif (*<span class="video-time">* iswm %sockreader) {
- set $+(%,ysearch.,$remove($sockname,ysearch.),.time) $nohtml($remove(%sockreader,Add to,Added,to,queue))
- }
- elseif (*<span class="username-prepend">* iswm %sockreader) {
- set $+(%,ysearch.,$remove($sockname,ysearch.),.user) $remove($nohtml(%sockreader),by)
- }
- elseif (*<span class="viewcount">* iswm %sockreader) {
- set $+(%,ysearch.,$remove($sockname,ysearch.),.viewcount) $remove($nohtml(%sockreader),|,views)
- $($+(%,ysearch.,$remove($sockname,ysearch.),.msgtype),2) 1,0You0,4Tube 10Link:4 http://youtube.com $+ $($+(%,ysearch.,$remove($sockname,ysearch.),.tag),2) 10Title:4 $($+(%,ysearch.,$remove($sockname,ysearch.),.title),2) 10Length:4 $($+(%,ysearch.,$remove($sockname,ysearch.),.time),2) 10Views:4 $($+(%,ysearch.,$remove($sockname,ysearch.),.viewcount),2) 10User:4 $($+(%,ysearch.,$remove($sockname,ysearch.),.user),2)
- unset $+(%,ysearch.,$remove($sockname,ysearch.),*)
- sockclose $sockname
- }
- }
- on $*:text:/youtu(.be|be.com)/Si:*: {
- if (($chan != #nova) && ($nick != Runescript)) {
- if ($($+(%,botflood.,$nick),2)) {
- if ($($+(%,botflood.,$nick),2) >= 50) { ignore -u60 $address($nick,0) | msg $chan $+($nick,$chr(44)) You Have Been Put On Ignore For 60secs For Abusing The Bot. | halt }
- elseif ($($+(%,botflood.,$nick),2) >= 40) { msg $chan $+($nick,$chr(44)) Please Do Not Abuse The Bot. | inc -z $+(%,botflood.,$nick) 20 | halt }
- else { inc -z $+(%,botflood.,$nick) 10 }
- }
- else { inc -z $+(%,botflood.,$nick) 10 }
- set %i 1
- var %ticks $ticks
- while (%i <= $numtok($1-,32)) {
- if ((*youtube.com* iswm $($+($,%i),2)) || (*youtu.be* iswm $($+($,%i),2))) {
- set $+(%,youtube.,%ticks,.url) $($+($,%i),2)
- set $+(%,youtube.,%ticks,.tag) $remove($strip($($+($,%i),2)),http://,www.,youtube.com,youtu.be/,/watch?v=,$chr(31))
- }
- inc %i
- }
- if (($me == Mafbot) || ($nick($chan,$me,@&~)) || ($istok(%youtubefetch,$chan,44))) {
- set $+(%,youtube.,%ticks,.msgtype) msg $chan
- }
- elseif (($me != Mafbot) && (!$nick($chan,$me,@&~)) && (!$istok(%youtubefetch,$chan,44))) {
- set $+(%,youtube.,%ticks,.msgtype) echo -a
- }
- if (($($+(%,youtube.,%ticks,.tag),2) != %_youtube.last) && ($($+(%,youtube.,%ticks,.tag),2) != $null)) {
- set $+(%,youtube.,%ticks,.nick) $nick
- set $+(%,youtube.,%ticks,.chan) $chan
- set $+(%,youtube.,%ticks,.network) $network
- sockopen $+(youtube.,%ticks) youtube.com 80
- }
- }
- }
- on *:sockopen:youtube*: {
- .timerSet 1 4 set %checksockname $sockname
- .timerCheck 1 5 checkifsockopen
- sockwrite -nt $sockname GET /watch?v= $+ $($+(%,youtube.,$remove($sockname,youtube.),.tag),2) HTTP/1.1
- sockwrite -nt $sockname Host: www.youtube.com
- sockwrite -nt $sockname $crlf
- }
- on *:SOCKREAD:youtube*: {
- if ($sockerr) { echo -a SOCKET ERROR: $sockerr | halt }
- else {
- var %sockreader
- sockread %sockreader
- if (*<meta name="title"* iswm %sockreader) {
- tokenize 32 %sockreader
- set $+(%,youtube.,$remove($sockname,youtube.),.title) $replace($remove(%sockreader,<meta name="title" content=",">),&quot;,",&#39;,',",",&,&,',')
- }
- elseif (*<span class="watch-view-count">* iswm %sockreader) {
- set $+(%,youtube.,$remove($sockname,youtube.),.viewcheck) on
- }
- elseif (*<a id="watch-username" class="inline-block" rel="author" href="/user/* iswm %sockreader) {
- set $+(%,youtube.,$remove($sockname,youtube.),.user) $nohtml(%sockreader)
- }
- elseif (*<a id="watch-userbanner" class="inline-block" rel="author" href="/user/* iswm %sockreader) {
- tokenize 34 %sockreader
- set $+(%,youtube.,$remove($sockname,youtube.),.user) $10
- }
- elseif ((*<strong>* iswm %sockreader) && ($($+(%,youtube.,$remove($sockname,youtube.),.viewcheck),2) == on)) {
- set $+(%,youtube.,$remove($sockname,youtube.),.viewcount) $nohtml(%sockreader)
- if ($($+(%,youtube.,$remove($sockname,youtube.),.msgtype),2) == echo -a) $($+(%,youtube.,$remove($sockname,youtube.),.msgtype),2) 12[4 $+ $($+(%,youtube.,$remove($sockname,youtube.),.chan),2) $+ 12] 1,0You0,4Tube 10Title:4 $($+(%,youtube.,$remove($sockname,youtube.),.title),2) 10Views:4 $($+(%,youtube.,$remove($sockname,youtube.),.viewcount),2) 10User:4 $($+(%,youtube.,$remove($sockname,youtube.),.user),2) 12From4 $($+(%,youtube.,$remove($sockname,youtube.),.nick),2) 10on12 $($+(%,youtube.,$remove($sockname,youtube.),.network),2)
- else { $($+(%,youtube.,$remove($sockname,youtube.),.msgtype),2) 1,0You0,4Tube 10Title:4 $($+(%,youtube.,$remove($sockname,youtube.),.title),2) 10Views:4 $($+(%,youtube.,$remove($sockname,youtube.),.viewcount),2) 10User:4 $($+(%,youtube.,$remove($sockname,youtube.),.user),2) }
- set %_youtube.last $($+(%,youtube.,$remove($sockname,youtube.),.tag),2)
- unset $+(%,youtube.,$remove($sockname,youtube.),*)
- sockclose youtube
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement