Use the Twitchtv JSON API

Developer
Size
3,561 Kb
Views
14,168

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 Previews

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);
});
Use the Twitchtv JSON API - Script Codes
Use the Twitchtv JSON API - Script Codes
Home Page Home
Developer Roksana
Username roksanaop
Uploaded November 22, 2022
Rating 3
Size 3,561 Kb
Views 14,168
Do you need developer help for Use the Twitchtv JSON 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!

Roksana (roksanaop) Script Codes
Create amazing art & images 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!