Use the Twitch.tv JSON API

Developer
Size
2,862 Kb
Views
2,024

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 Previews

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
Use the Twitch.tv JSON API - Script Codes
Home Page Home
Developer Sky
Username skycoder
Uploaded January 29, 2023
Rating 3
Size 2,862 Kb
Views 2,024
Do you need developer help for Use the Twitch.tv 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!

Sky (skycoder) Script Codes
Create amazing video scripts 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!