Destiny Level 22 Weekly Strike in 5 Minuten

Destiny planet view im Stile von Google Maps - Wow!

BESTE POSTILLON SATIRE ALLER ZEITEN OH MAN GUTE NACHT LIEBE WELT ...

Ich im Handelsblatt (ganz unten)

Die meistgesuchten Frauen im Internet

Wir haben jetzt auch endlich SEO URLs - Bugs bitte ich zu entschuldigen... ICH BIN BEIM FIXEN! :p

Die Accounting Seite ist jetzt in Tabellenform.

Man kann jetzt den Hintergrund ausblenden, um die Performance zu steigern. Das Ganze wird in einem Cookie gespeichert. Sitemap - Hide Background

Um einen coolen Lightning Bildschirmschoner zu starten einfach unter Sitemap - Hide Elements alles ausblenden :)

Super cooler Rennsitz, den man als Tisch verwenden kann

Einen guenstiger Mietwagen finden

Deutscher Spass

show all


coding articles

Twitch Sockread Script for mIRC

For the new Twitch API from 2016

8379 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!



Update 05/29/2017


The code above is obsolete since Twitch implemented an authentication for its new API, but there is a new one:

;Twitch Info 2.0
;Created with new Oauth Twitch Api Authentication
;Originally by Neo Nemesis (YouTube Reader) updated by Lightningsoul.com // Lightningsoul.de

alias twitch {
%twitchCallUrl = $remove($1,https://,www.,twitch,.tv)
sockopen twitch www.twitch.tv 443
sockopen -e twitchprofile api.twitch.tv 443
%twitchCallUrlAPI = /kraken/streams $+ %twitchCallUrl $+ ?client_id=[YOURAPIKEY]
}

on *:SOCKOPEN:twitch: {
sockwrite -n $sockname GET %twitchCallUrl 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 %twitchCallUrlAPI 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) {
%twitchLive = 1
if ("stream" isin %temp) {
%twitchGameStart = $pos(%temp, game, 1)
%twitchGameEnd = $pos(%temp, viewers, 1)
%twitchGameBetween = $calc(%twitchGameEnd - %twitchGameStart)
%twitchGame = $mid(%temp, $calc(%twitchGameStart +5), $calc(%twitchGameBetween - 7))
%twitchGame = $remove(%twitchGame, ")
%twitchGame = $replace(%twitchGame, :,)
msg %ircChan %twitchTeaserText 6,0 Game: %twitchGame 
}
if (viewers isin %temp) {
%twitchViewersStart = $pos(%temp, viewers, 1)
%twitchViewersEnd = $pos(%temp, video_height, 1)
%twitchViewersBetween = $calc(%twitchViewersEnd - %twitchViewersStart)
%twitchViewers = $mid(%temp, $calc(%twitchViewersStart +8), $calc(%twitchViewersBetween - 10))
%twitchViewers = $remove(%twitchViewers, ")
%twitchViewers = $replace(%twitchViewers, :, )
msg %ircChan %twitchTeaserText 6,0 Viewers: %twitchViewers 
echo -ag %temp
}
}

goto nextread
}

on *:SOCKCLOSE:twitchprofile: {
if (%twitchLive == 1) {
msg %ircChan %twitchTeaserText 6,0 LIVE
}
else {
msg %ircChan %twitchTeaserText 6,0 OFFLINE
}
}

on *:SOCKREAD:twitch: {
sockread %twitchResponse
if (%twitchResponse == $null) && (%lgsr == $null) {
msg %ircChan 0,6 TWITCH15,1 Error receiving information.
set %lgsr 1
}
elseif (%twitchResponse == $null) && (#sockread != $null) { noop }
else %endtitle2 = $pos(%twitchResponse,/>,1)
%starttitle2 = $pos(%twitchResponse, %starttitle3 = $pos(%twitchResponse,",1))
%inbetween3 = $calc(%endtitle2 - %starttitle3)

}

on *:TEXT:*twitch.tv*:#: {
%ircChan = $chan
%twitchResponseWord = 1
%twitchTeaserText = 0,6 TWITCH
while ([ $chr(36) $+ [ %twitchResponseWord ] ]) {
if (twitch.tv/ isin [ $chr(36) $+ [ %twitchResponseWord ] ]) {
sockclose twitch
sockclose twitchprofile
%twitchLive = 0
twitch [ $chr(36) $+ [ %twitchResponseWord ] ]
}
inc %twitchResponseWord
}
}

All you need to do is exchange [YOURAPIKEY] with the one you get on creating a new APP.


Links: related

Monday 29th of May 2017 at 23:23

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

#431 Kati
Tuesday 30th of May 2017 at 01:05
he has updated it ?????????


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