2014-05-17 2 views
0

hitbox라는이 사이트가 있습니다. 그것은 트 위치와 비슷하지만, 내가 볼 수있는 한, API는 다소 다릅니다! 트위터 팔로어 경고를 받아 코드를 변경하여 히트 박스와 작동하도록 만들었지 만 운이 없었습니다. 시간이 많이 걸리기 때문에 전체 프로그램을 만들고 싶지 않습니다. 난 그냥 웹 페이지를 만들고 거기에 최신 추종자를 표시하고 싶습니다. hitbox API는 here입니다. mIRC에서 그런 일을하는 것이 더 쉬울 것이라고 생각된다면 그렇게하는 것이 좋지만 웹 페이지에서 그렇게하는 것이 더 쉬울 것이라고 생각합니다. 나는 프로그래밍에있어 총 n00b이기 때문에 모든 것을 이해할 수 있다면 설명해 줄 수있다. (나는 코드에 익숙해지기를 원하지만 어디서부터 시작해야할지 모른다. 적어도 나는 꽤 젊다. 구글에 hitbox에서 몇 가지 정보를 검색하는 동안 게시를 통해 앤드류Hitbox Follower Alert

답변

3

난 그냥 온 - 14) 그래서 나는) 당신이

감사를 그렇게 할 충분한 시간을 가지고있다. 그리고 너 알 잖아!? 30 분 전에 팔로어 경보 앱을 만들었습니다. 여기 코드가 있습니다. 실제로는 매우 간단합니다. (hitbox_followeralert.js) 내가 모든 것을 간단하게 그들의 전체 웹 페이지를 복사 NightDev에서 트 위치 추종자 경보에서 자신을 영감 때문에

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); 

. 여기에 페이지가 있습니다. (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> 

당신은 사용자 이름과 일치 상단의 채널 변수를 변경해야합니다. 사운드 파트가 필요하지 않은 경우 삭제할 수도 있습니다. 또한 루트 폴더에 template.png이라는 간단한 배경을 만들었습니다. 그래서이 litte 프로젝트를 만들기 위해 4 개의 파일이 있습니다 : index.html, hitbox_followeralert.js, AlertSound.ogg, template.png

그런 다음 OBS에 추가하려면 CLR Browser라는 플러그인을 사용했습니다. !

희망이 도움이 될 수 있으며 귀하의 질문에 너무 늦게 답할 수 없습니다. -MaitreChocobo