Twitch API
How do I make an twitch api?
What is a twitch api? How do you make a twitch api? This script and codes were developed by Jessica Pittman on 28 October 2022, Friday.
Twitch API - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Twitch API</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <button id="btnoffline">Offline</button>
<button id="btnonline">Online</button>
<button id="btnall" class="active">All</button><br><br>
<div id="offline"></div>
<div id="online"></div>
<div id="all"></div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Twitch API - Script Codes CSS Codes
.active { font-weight: bold;
}
Twitch API - Script Codes JS Codes
$(document).ready(function() { var user = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas", "brunofin", "comster404"]; $.each(user, function(i, val) { $.getJSON("https://api.twitch.tv/kraken/streams/" + user[i] + "?client_id=8hr44qpyfpe9jv6x4msf68phimvbe9s&callback=?", Twitch); function Twitch(data) { var online = []; var offline = []; if (data.stream) { online.push('<img src="' + data.stream.channel.logo + '" width="50"><a href="' + data.stream.channel.url + '" target="_blank">' + data.stream.channel.display_name + '</a>, Playing: ' + data.stream.game + '<br>'); } else if (!(data.error)) { offline.push("<a href='https://www.twitch.tv/" + user[i] + "' target='_blank'>" + user[i] + "</a><br>"); } else { offline.push(user[i] + " - Not Found<br>"); } var all = online.concat(offline); $("#online").append(online); $("#offline").append(offline); $("#all").append(all); } }); $("#offline").hide(); $("#online").hide(); $("#all").show(); $("#btnoffline").click(function() { $("#offline").show(); $("#online, #all").hide(); }); $("#btnonline").click(function() { $("#online").show(); $("#offline, #all").hide(); }); $("#btnall").click(function() { $("#all").show(); $("#offline, #online").hide(); }); $('button').click(function(e) { e.preventDefault(); $('button').removeClass('active'); $(this).addClass('active'); });
});
Developer | Jessica Pittman |
Username | jessikuh |
Uploaded | October 28, 2022 |
Rating | 3 |
Size | 2,229 Kb |
Views | 22,264 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Tribute Page | 3,087 Kb |
Steven Finlay | 3,892 Kb |
Wordpress Menu | 2,221 Kb |
Font Combinations | 1,640 Kb |
Commissioned Skin | 2,399 Kb |
Scheme Ideas | 8,838 Kb |
Home Energy Solutions Banner | 2,422 Kb |
Personal Portfolio | 3,389 Kb |
Random Quote Generator | 3,909 Kb |
A Pen by Jessica Pittman | 2,123 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Background Images | Jooonebug | 2,100 Kb |
Bootstrap example | Ssaakkaa | 2,716 Kb |
Obligatory CSS3 UI Nav | Romandiaz | 9,017 Kb |
A Pen by Andrea Verlicchi | Verlok | 2,018 Kb |
Scroll Arrow | Robooneus | 4,437 Kb |
Heartbeat | Apetrov | 2,079 Kb |
Simple Login Form Template | Banunn | 3,571 Kb |
A Pen by Jess | Jessamyne | 5,100 Kb |
Login-ng-modal | Heedoo | 3,566 Kb |
DFF Website | Hawcubite | 10,123 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!