wrong national anthem?!

destiny planet view like google maps - cool!

combined celebrities

new scifi show with Halle Berry

microsoft pays macbook users to swap to surface

upcoming ps4 games

billboard 2014 playlist on youtube

15 cool unknown movies

most googled women on the web

we now have SEO optimized URLs - please excuse any bugs this brings up... I AM ON IT :p

25 websites to kill time

100 worst tattoos ever

show all


coding articles

Twitch Sockread Script for mIRC

even gives out if channel is live or not

7685 Views



This msl script for mIRC will read a twitch channel page and post the infos of the channel onto the IRC channel the message was sent to. As a special it will also check if the channel is currently live or not.

;Twitch Info 1.0
;Originally by Neo Nemesis (YouTube Reader) updated by Lightningsoul.com


alias twitch {
%ttwitch1 = $remove($1,http://,www.,twitch,.tv)
sockopen twitch www.twitch.tv 80
sockopen -e twitchprofile api.twitch.tv 443
%ttwitch11 = /kraken/streams $+ %ttwitch1
}
on *:SOCKOPEN:twitch: {
sockwrite -n $sockname GET %ttwitch1 HTTP/1.1
sockwrite -n $sockname Host: www.twitch.tv
sockwrite -n $sockname Connection: Keep-Alive
sockwrite -n $sockname Content-Type: text/html
sockwrite -n $sockname $crlf
}
on *:SOCKOPEN:twitchprofile: {
sockwrite -n $sockname GET %ttwitch11 HTTP/1.1
sockwrite -n $sockname Host: api.twitch.tv
sockwrite -n $sockname Connection: close
sockwrite -n $sockname $crlf
}
on *:sockread:twitchprofile:{
if ($sockerr > 0) return
:nextread
sockread -f %temp
if ($sockbr == 0) return
if (%temp == $null) %temp = -
if (_id isin %temp) {
%twoffline = 1
}
goto nextread
}
on *:SOCKCLOSE:twitchprofile: {
if (%twoffline == 1) {
msg %ttwitch3 %ymoon 6,0 LIVE
}
}


on *:SOCKREAD:twitch: {
sockread %ttwitch2
if (%ttwitch2 == $null) && (%lgsr == $null) {
msg %ttwitch3 0,6 TWITCH15,1 Error receiving information.
set %lgsr 1
}
elseif (%ttwitch2 == $null) && (#sockread != $null) { noop }
elseif ( %endtitle2 = $pos(%ttwitch2,/>,1)
%starttitle2 = $pos(%ttwitch2, %starttitle3 = $pos(%ttwitch2,",1)
%inbetween3 = $calc(%endtitle3 - %starttitle3)
msg %ttwitch3 %ymoon 6,0 Game: $mid(%ttwitch2,$calc(%starttitle3 + 1),$calc(%inbetween3 - 1)) 
}
on *:TEXT:*twitch.tv*:#: {
%ttwitch3 = $chan
%ttwitch4 = 1
%ymoon = 0,6 TWITCH
while ([ $chr(36) $+ [ %ttwitch4 ] ]) {
if (twitch.tv/ isin [ $chr(36) $+ [ %ttwitch4 ] ]) {
sockclose twitch
sockclose twitchprofile
%twoffline = 0
twitch [ $chr(36) $+ [ %ttwitch4 ] ]
}
inc %ttwitch4
}
}

Yes, I am proud of my shitty formatting and stupid variables. ;) Thanks again to Kati, #help.script (Quakenet) and Neo Nemesis for helping me do it and building it in the first place!


Links: related

Sunday 22nd of December 2013 at 23:03

Share




comments


#312 Kati
Monday 23rd of December 2013 at 08:59
I promise, this is the best script ever!! :D

#3 anonymous
Saturday 23rd of August 2014 at 20:46
If you ever decide to make another script, please add some comments and use variable names which make sense. I wanted to use some of this script for my own, but couldn\'t make any sense of it because of how chaotic it is written.

#383 Lightningsoul
Friday 29th of August 2014 at 06:05
yeah you are right, it is very chaotic. but if you need help with anything you can just ask me here or via a communication method given on this site (irc, mail etc.). :)

#5 AnubisxHades
Thursday 6th of November 2014 at 04:48
Would you be willing to simplify it to just the channel online check? trying to make an online check that runs off a timer for an auto unhost bot I\'m working on. If you can that would be wonderful email is axhpay at gmail


Name

Message

You can post URLs (will be clickable automatically) and images via the [img]http://picurl[/img] tag.

Calculate 7 minus 3 (Robot check)

Back to Top

show elements