live streaming - Hitbox Follower Alert -
there site called hitbox. it's similar twitch far can see api rather different! tried take twitch follower alert , change code bit make work hitbox no luck. don't want create whole program because take lot of time. want make webpage , display latest follower on there. hitbox api can found here. if think easier in mirc way think easier webpage. total n00b when comes programming if explain me appreciate (i want start learing code don't know start. @ least quite young (14) have enough time that)
thanks - andrew
i came across post while searching information on hitbox on google. , know what!? made follower alert app 30 min ago. here code, it's simple. (hitbox_followeralert.js)
var followers = 0, lastcheck = 0, lastfollower = "", sound = new audio("alertsound.ogg"), channel = "maitrechocobo"; function checkfornew(){ $.getjson("http://api.hitbox.tv/user/"+channel, function(data){ followers = data.followers; if(followers > lastcheck && lastcheck!=0){ sound.play(); $.getjson("http://api.hitbox.tv/followers/user/"+channel+"?offset="+(followers-1), function(gata){ $("#new-follower").html(gata.followers[0].user_name); $("#follower-alert .text").css("font-size", "45px"); $("#follower-alert").fadein("slow"); settimeout(function(){ $("#follower-alert").fadeout("slow"); }, 10000); }) } lastcheck = followers; }).fail(function(){ console.log('an error occurred!'); }); } setinterval(checkfornew, 5000);
since inspired myself twitch follower alert nightdev copied whole webpage make simpler. here page. (index.html)
<html> <head> <meta charset="utf-8"> <title>follower alert</title> <style> body { background-color: transparent; color: white; } #follower-alert { display: none; position: absolute; top: 0px; left: 0px; width: 580px; height: 110px; } #follower-alert .text { margin-left: 170px; padding-top: 45px; text-align: center; width: 385px; line-height: 45px; vertical-align: middle; font-size: 45px; font-family: impact; text-shadow: 2px 2px 1px #000; white-space: nowrap; color: #ffffff; } </style> <style type="text/css"></style></head> <body> <div id="follower-alert" style="background-image: url(template.png);"> <div class="text" id="new-follower" style="margin-left: 15px; width: 550px;"></div> </div> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script src="hitbox_followeralert.js"></script> </body> </html>
you have change channel variable @ top match username. delete sound part if don't need it. made simple background called template.png in root folder. have 4 files make litte project : index.html, hitbox_followeralert.js, alertsound.ogg, template.png
then add obs used plugin called clr browser , you're go!
hope , i'm not late answer question. -maitrechocobo
Comments
Post a Comment