Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;Made by nick1
- ;Last edit april 25 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 }
- if ($sock(ysearch)) { msg $chan $nick $+ : Please wait, already searching. | halt }
- elseif ($2) {
- set %ysearch.msgtype $iif($left($strip($1),1) == @,msg $chan,notice $nick)
- set %ysearch.search $replace($2-,$chr(32),+)
- sockopen ysearch 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.msgtype msg $active
- set %ysearch.search $replace($2-,$chr(32),+)
- sockopen ysearch youtube.com 80
- }
- elseif (*youtube.com* iswm $1-) {
- set %i 1
- while (%i <= $numtok($1-,32)) {
- if (*youtube.com* iswm $($+($,%i),2)) {
- set %youtube.url $($+($,%i),2)
- set %youtube.tag $remove($($+($,%i),2),http://,www.,youtube.com)
- }
- inc %i
- }
- set %youtube.msgtype msg $active
- set %youtube.nick $nick
- set %youtube.chan $chan
- set %youtube.network $network
- sockopen youtube youtube.com 80
- }
- elseif (($1 == !youtubelinks) || ($1 == !youtubefetch)) {
- 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)) {
- 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.search 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.title $regsubex($nohtml($replace($remove(%sockreader,|),<b>,,</b>,,",")),/&#(\d\d?\d?\d?);/g,$chr(\1))
- tokenize 34 %sockreader
- set %ysearch.tag $2
- }
- elseif (*</div><h3* iswm %sockreader) {
- set %ysearch.title $regsubex($nohtml($replace($remove(%sockreader,|),<b>,,</b>,,",",&,-)),/&#(\d\d?\d?\d?);/g,$chr(\1))
- tokenize 34 %sockreader
- set %ysearch.tag $4
- }
- elseif (*<span class="video-time">* iswm %sockreader) {
- set %ysearch.time $nohtml($remove(%sockreader,Add to,Added,to,queue))
- }
- elseif (*<span class="username-prepend">* iswm %sockreader) {
- set %ysearch.user $remove($nohtml(%sockreader),by)
- }
- elseif (*<span class="viewcount">* iswm %sockreader) {
- set %ysearch.viewcount $remove($nohtml(%sockreader),|,views)
- %ysearch.msgtype 1,0You0,4Tube 10Link:4 http://youtube.com $+ %ysearch.tag 10Title:4 %ysearch.title 10Length:4 %ysearch.time 10Views:4 %ysearch.viewcount 10User:4 %ysearch.user
- sockclose $sockname
- unset %ysearch.*
- }
- }
- on $*:text:/youtube.com/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) 10 }
- }
- else { inc -z $+(%,botflood.,$nick) 10 }
- set %i 1
- if ($sock(youtube)) {
- msg $chan $nick $+ : Please wait, already working on a vid.
- halt
- }
- while (%i <= $numtok($1-,32)) {
- if (*youtube.com* iswm $($+($,%i),2)) {
- set %youtube.url $($+($,%i),2)
- set %youtube.tag $remove($($+($,%i),2),http://,www.,youtube.com)
- }
- inc %i
- }
- if (($me == Mafbot) || ($nick($chan,$me,@&~)) || ($istok(%youtubefetch,$chan,44))) {
- set %youtube.msgtype msg $chan
- }
- elseif (($me != Mafbot) && (!$nick($chan,$me,@&~)) && (!$istok(%youtubefetch,$chan,44))) {
- set %youtube.msgtype echo -a
- }
- if (%youtube.tag != %_youtube.last) {
- set %youtube.nick $nick
- set %youtube.chan $chan
- set %youtube.network $network
- sockopen youtube youtube.com 80
- }
- }
- on *:sockopen:youtube: {
- .timerSet 1 4 set %checksockname $sockname
- .timerCheck 1 5 checkifsockopen
- sockwrite -nt $sockname GET %youtube.tag 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.title $replace($remove(%sockreader,<meta name="title" content=",">),&quot;,",&#39;,',",",&,&,',')
- }
- elseif (*<span class="watch-view-count">* iswm %sockreader) {
- set %youtube.viewcheck on
- }
- elseif (*<a id="watch-username" class="inline-block" rel="author" href="/user/* iswm %sockreader) {
- set %youtube.user $nohtml(%sockreader)
- }
- elseif (*<a id="watch-userbanner" class="inline-block" rel="author" href="/user/* iswm %sockreader) {
- tokenize 34 %sockreader
- set %youtube.user $10
- }
- elseif ((*<strong>* iswm %sockreader) && (%youtube.viewcheck == on)) {
- set %youtube.viewcount $nohtml(%sockreader)
- if (%youtube.msgtype == echo -a) %youtube.msgtype 12[4 $+ %youtube.chan $+ 12] 1,0You0,4Tube 10Title:4 %youtube.title 10Views:4 %youtube.viewcount 10User:4 %youtube.user 12From4 %youtube.nick 10on12 %youtube.network
- else { %youtube.msgtype 1,0You0,4Tube 10Title:4 %youtube.title 10Views:4 %youtube.viewcount 10User:4 %youtube.user }
- sockclose youtube
- set %_youtube.last %youtube.tag
- unset %youtube.*
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement