coding articles

Twitch Sockread Script for mIRC

even gives out if channel is live or not


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

alias twitch {
%ttwitch1 = $remove($1,http://,www.,twitch,.tv)
sockopen twitch 80
sockopen -e twitchprofile 443
%ttwitch11 = /kraken/streams $+ %ttwitch1
on *:SOCKOPEN:twitch: {
sockwrite -n $sockname GET %ttwitch1 HTTP/1.1
sockwrite -n $sockname Host:
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:
sockwrite -n $sockname Connection: close
sockwrite -n $sockname $crlf
on *:sockread:twitchprofile:{
if ($sockerr > 0) return
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:**:#: {
%ttwitch3 = $chan
%ttwitch4 = 1
%ymoon = 0,6 TWITCH
while ([ $chr(36) $+ [ %ttwitch4 ] ]) {
if ( 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



#1 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.

#4 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



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