Use the Twitchtv JSON API
How do I make an use the twitchtv json api?
What is a use the twitchtv json api? How do you make a use the twitchtv json api? This script and codes were developed by Roksana on 22 November 2022, Tuesday.
Use the Twitchtv JSON API - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Use the Twitchtv JSON API</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <!DOCTYPE HTML>
<html lang="en">
<head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> <title>Exercise - Use the Twitchtv JSON API</title> <link rel="stylesheet" href="main.css" type="text/css" /> <script src="https://use.fontawesome.com/f9a688749b.js"></script> <link href="https://fonts.googleapis.com/css?family=Raleway" rel="stylesheet"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
</head>
<body> <header class="page-header"> <h1>Twitch.tv Status</h1> <h3 class="fcc"></h3> </header> <div class="container"> <div class="header-column"> <div class="column columnAll active">ALL</div> <div class="column columnOnline">ONLINE</div> <div class="column columnOffline">OFFLINE</div> </div> <div class="main-row"> <div class="column">Logo</div> <div class="column">Username</div> <div class="column">Status</div> </div> <!-- <div class="rows"> <div class="logo"><img src="" />IMAGE</div> <div class="username"><a href="#">USERNAME</a></div> <div class="status">STATUS</div> </div> --> </div> <footer> <p>by <a href="#">Roksana</a></p> </footer> <script src="main.js"></script>
</body> <script src="js/index.js"></script>
</body>
</html>
Use the Twitchtv JSON API - Script Codes CSS Codes
html { font-size: 62.5%; margin: 0; padding: 0;
}
body { margin: 0; padding: 0; font-family: 'Raleway', sans-serif; font-size: 2.5rem; color: #F9F4F5; background: #C8B8DB;
}
.page-header, .page-header a { width: 100%; text-align: center; color: #F9F4F5; text-decoration: none;
}
.page-header a:hover { color: #502F4C;
}
.container { width: 60%; margin: 50px 0; margin-right: auto; margin-left: auto; padding: 0; text-align: center; color: #F9F4F5; font-size: 2rem; border: 1px solid #F9F4F5;
}
.container .header-column { width: 100%; display: flex; margin: 0; padding: 0; text-align: center; background-color: #502F4C; font-size: 2rem; border: 1px solid #F9F4F5;
}
.container .header-column .columnAll, .columnOnline, .columnOffline { width: 30%; padding: 20px; text-align: center; font-size: 2rem; cursor: pointer;
}
.header-column .active { background-color: #F9F4F5; color: #502F4C;
}
.main-row, .rows { width: 100%; display: flex; margin: 0; padding: 0; text-align: center; color: #502F4C; background-color: #F9F4F5; align-items: center;
}
.main-row { font-weight: bold;
}
.hide { display: none;
}
.column, .logo, .username, .status { width: 30%; padding: 20px; text-align: center; font-size: 2rem;
}
.logo img { border-radius: 50%; height: 60px;
}
.username a { text-decoration: none; color: #502F4C;
}
.username a:hover { text-decoration: none; color: #C8B8DB;
}
footer { position: fixed; right: 10px; bottom: 5px; text-align: center; color: #502F4C; font-size: 1.8rem;
}
footer p { margin: 0; padding: 0;
}
footer a { text-decoration: none; color: #502F4C;
}
Use the Twitchtv JSON API - Script Codes JS Codes
var usernames = ["ESL_SC2", "OgamingSC2", "cretetion", "freecodecamp", "storbeck", "habathcx", "RobotCaleb", "noobs2ninjas", "brunofin", "comster404"];
function statusFCC() { var urlFCC = "https://wind-bow.gomix.me/twitch-api/streams/freecodecamp?callback=?"; $.ajax ({ url: urlFCC, dataType: 'json', type: 'GET', headers: { 'Api-User-Agent': 'Example/1.0' }, success: function(dataFCC) { if (dataFCC.stream) { $(".fcc").html("<a href='https://www.twitch.tv/freecodecamp' target='_blank'>FreeCodeCamp is ONLINE right now!</a>"); } if (!dataFCC.stream) { $(".fcc").html("FreeCodeCamp is OFFLINE."); } } });
}
function getURL(index, channel) { return url = "https://wind-bow.gomix.me/twitch-api/" + index + "/" + channel + "?callback=?";
}
function statusChannels() { usernames.forEach(function (channelId) { var url = getURL("streams", channelId); $.ajax ({ url: url, dataType: 'json', type: 'GET', headers: { 'Api-User-Agent': 'Example/1.0' }, success: function(statusChannel) { var logo, user, status, active, link; if (statusChannel.stream === null) { status = "Offline"; active = "off"; } if (statusChannel.stream === undefined) { status = "Account Closed"; active = "off"; } if (statusChannel.stream) { status = statusChannel.stream.game; active = "on"; } var channelURL = getURL("channels", channelId); $.ajax ({ url: channelURL, dataType: 'json', type: 'GET', headers: { 'Api-User-Agent': 'Example/1.0' }, success: function(dataChannel) { logo = dataChannel.logo || "https://upload.wikimedia.org/wikipedia/commons/a/ac/No_image_available.svg"; user = dataChannel.display_name || channelId; link = dataChannel.url || ""; contentOnline = "<div class='rows online'><div class='logo'><img src='" + logo + "'/></div><div class='username'><a href='" + link + "' target='_blank'>" + user + "</a></div><div class='status'>" + status + "</div></div>"; contentOffline = "<div class='rows offline'><div class='logo'><img src='" + logo + "'/></div><div class='username'><a href='" + link + "' target='_blank'>" + user + "</a></div><div class='status'>" + status + "</div></div>"; (active === "on") ? $(".container").append(contentOnline) : $(".container").append(contentOffline); } }); } }); });
}
var all = $(".columnAll");
var online = $(".columnOnline");
var offline = $(".columnOffline");
function openMenu() { $(this).animate( { left: '50px', height: '25px', width: '50%' }, "slow"); $(".column").removeClass("active"); $(this).addClass("active"); $(".column").css("width", "30%"); if (all.hasClass("active")) { $(".offline").show(); $(".online").show(); } if (online.hasClass("active")) { $(".offline").hide(); $(".online").show(); } if (offline.hasClass("active")) { $(".online").hide(); $(".offline").show(); }
}
$(document).ready(function () { statusFCC(); statusChannels(); all.click(openMenu); online.click(openMenu); offline.click(openMenu);
});

Developer | Roksana |
Username | roksanaop |
Uploaded | November 22, 2022 |
Rating | 3 |
Size | 3,561 Kb |
Views | 14,161 |
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 |
Build a JavaScript Calculator | 2,903 Kb |
Built a Tribute Page | 3,726 Kb |
Exercise - Build a Tribute Page | 5,463 Kb |
Build a Tic Tac Toe Game | 3,883 Kb |
Build a Wikipedia Viewer - FCC | 2,910 Kb |
Build a Simon Game | 4,017 Kb |
Weather App | 2,957 Kb |
Exercise - Build a Random Quote Machine | 4,604 Kb |
Build a Pomodoro Clock | 3,419 Kb |
Image Processing | 3,788 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 |
Lazy Load for Background Images | The_ruther4d | 2,977 Kb |
Material design - button rainbow circle | Kunukn | 3,652 Kb |
CSS- UI Element States Pseudo-Classes | Tesla809 | 2,206 Kb |
Calculator | Rzencoder | 4,572 Kb |
Promodoro | Bencarp | 1,712 Kb |
A Pen by boilzzz | Boilzzz | 2,761 Kb |
Incremental game | Eprouver | 5,868 Kb |
Polo, the flying squirrel | Agbales | 2,445 Kb |
LAMP PURE CSS with Animation | Dam62500 | 2,911 Kb |
CSS Grid Overlay | Cliffpyles | 3,090 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!