Use the Twitch.tv JSON API
How do I make an use the twitch.tv json api?
What is a use the twitch.tv json api? How do you make a use the twitch.tv json api? This script and codes were developed by Sky on 29 January 2023, Sunday.
Use the Twitch.tv JSON API - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Use the Twitch.tv JSON API</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <img class="twitch-logo" src="https://s17.postimg.org/65dvyos4f/Twitch_White_RGB.png">
<div class="filters"> <button id="all" onclick="filter(this.id)">All</button> <button id="offline" onclick="filter('online')">Offline</button> <button id="online" onclick="filter('offline')">Online</button>
</div>
<div id="streamers"></div> <script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Use the Twitch.tv JSON API - Script Codes CSS Codes
html { min-height: 100vh;
}
body { background-image: -webkit-linear-gradient( 315deg, #6441a4 10%, #3b2064 100%); background-image: linear-gradient( 135deg, #6441a4 10%, #3b2064 100%); font-family: sans-serif; margin: 0 auto; height: 100%; max-width: 1280px; min-width: 285px; text-align: center;
}
.twitch-logo { width: 280px; padding: 30px 0;
}
.filters button { background-color: #222; border-color: transparent; border-radius: 4px; color: #eee; cursor: pointer; font-weight: bold; margin: 20px 5px; padding: 5px 10px; width: 80px;
}
.filters button:hover { background-color: #252525; box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.2), 0 1px 3px 0 rgba(0, 0, 0, 0.19);
}
.logo { border-radius: 50%; width: 128px;
}
.channel-card { background-color: #fff; border: 1px solid #888; color: #222; box-shadow: 0 8px 17px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19); display: inline-block; margin: 5px; padding: 10px 10px 0; width: 275px; min-height: 230px; overflow: hidden; white-space: nowrap; text-decoration: none;
}
.channel-card.online { background-color: rgba(0, 255, 0, 0.5);
}
/*
.online .stream { animation: marquee 10s ease-in-out infinite;
}
@keyframes marquee { 0% { margin-left: 100%; } 100% { margin-left: -300%; }
}
*/
Use the Twitch.tv JSON API - Script Codes JS Codes
window.onload = () => {
const channels = ["cretetion", "ESL_SC2", "habathcx", "freecodecamp", "dizzykitten", "noobs2ninjas", "RobotCaleb", "Morberplz", "riotgames", "legendarylea", "comster404", "brunofin"];
Promise.all(channels.map(channel => Promise.all([ fetch("https://wind-bow.glitch.me/twitch-api/channels/" + channel).then(res => res.json()), fetch("https://wind-bow.glitch.me/twitch-api/streams/" + channel).then(res => res.json()) ]))).then(data => data.forEach(showStreamer)).catch(console.error);
}
function showStreamer(res) { const name = res[0].display_name || res[1]._links.channel.split("/").pop(); streamers.innerHTML += `<a class="channel-card ${res[1].stream != null ? "online" : "offline"}" href="${"https://www.twitch.tv/" + name}" target="_blank"> <img class="logo" src="${res[0].logo || "https://goo.gl/58GNGh"}"> <h4>${name}</h4><div class="stream">${res[1].stream != null ? res[0].status : res[0].error ? "Closed Account" : "Offline"}</div> </a>`;
}
function filter(id) { [...document.querySelectorAll('.online, .offline')].forEach(el => el.style.display = ""); [...document.getElementsByClassName(id)].forEach(el => el.style.display = "none"); [...document.getElementsByClassName(id)].forEach(el => el.style.display = "none");
}
![Use the Twitch.tv JSON API - Script Codes](http://shots.codepen.io/skycoder/pen/prrOvy-512.jpg)
Developer | Sky |
Username | skycoder |
Uploaded | January 29, 2023 |
Rating | 3 |
Size | 2,862 Kb |
Views | 2,024 |
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 |
Colors and Sounds | 4,204 Kb |
Random Quote Machine | 2,259 Kb |
Dark Sky - Simple 5-day Forecast | 4,941 Kb |
Bootstrap 3 Grid Example | 2,111 Kb |
Ionicons | 6,688 Kb |
JSONP Examples with the Dark Sky API | 5,884 Kb |
Portfolio - Work In Progress | 4,572 Kb |
Vanilla JS Forismatic Example | 2,284 Kb |
Feather Icons | 2,918 Kb |
Show the Local Weather - and a local background image | 8,205 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 |
Sencha Touch 2.3.1 Basic Grid Example | Trozdol | 2,770 Kb |
Flat buttons for Eliassen.com | Kdooley89 | 1,737 Kb |
Hoi hoi | JohnTheCat | 7,248 Kb |
Direction-icon | Alexandremasy | 3,323 Kb |
CSS- UI Element States Pseudo-Classes | Tesla809 | 2,206 Kb |
Touch Carousel - last, no gaps. | Berkin | 4,332 Kb |
Twinner Spinner II | Katydecorah | 2,974 Kb |
Blackberry Mock | Zacharyolson | 1,865 Kb |
Subtle site navigation with description | Necks | 3,206 Kb |
A Pen by Mike Otis | Mikeotis | 3,185 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!