Twitch API

Size
2,229 Kb
Views
22,264

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 Previews

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'); });
});
Twitch API - Script Codes
Twitch API - Script Codes
Home Page Home
Developer Jessica Pittman
Username jessikuh
Uploaded October 28, 2022
Rating 3
Size 2,229 Kb
Views 22,264
Do you need developer help for Twitch API?

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!

Jessica Pittman (jessikuh) Script Codes
Create amazing web content with AI!

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!