Twitch.tv API Query

Developer
Size
3,631 Kb
Views
22,264

How do I make an twitch.tv api query?

What is a twitch.tv api query? How do you make a twitch.tv api query? This script and codes were developed by Paulo Sérgio on 19 November 2022, Saturday.

Twitch.tv API Query Previews

Twitch.tv API Query - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Twitch.tv API Query</title> <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css'> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="container" ng-app="myApp"> <div class="jumbotron text-center"> <h1>Twitch.tv Api Query</h1> <input class="form-control" ng-model="search" type="text" placeholder="Type here"> </div> <div class="row" ng-controller="TwitchController"> <div class="col-md-12" ng-repeat="user in userlist | filter:search"> <div class="panel panel-default" ng-class="user.class"> <div class="panel-heading">{{user.name}}</div> <div class="panel-body"> <div class="media"> <a class="media-left" href="#"> <img class="media-object" ng-src="{{user.logo}}" alt="{{user.name}}"> </a> <div class="media-body"> <div class="row"> <div class="col-md-6"> <h4 ng-if="user.status" class="media-heading"><b>Broadcasting: {{user.status}}</b></h4> <blockquote> <a target="_blank" ng-href="{{user.url}}">{{user.name}}</a> <footer ng-if="user.status">{{user.name}}</footer> </blockquote> </div> <div class="col-md-6"> <div class="pull-right"> <div class="label" ng-class="getStatus(user.status)"> <i class="glyphicon glyphicon-info-sign"></i> </div> &nbsp;&nbsp;{{getText(user.status)}} </div> </div> </div> </div> <!-- end of body --> </div> </div> <!-- end panel body --> </div> </div> </div>
</div> <script src='https://code.jquery.com/jquery-2.2.4.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.5.5/angular.min.js'></script>
<script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Twitch.tv API Query - Script Codes CSS Codes

.scale { -webkit-transition-duration: 1s; /* Safari */ transition-duration: 1s; -ms-transform: scale(1.2, 1.2); /* IE 9 */ -webkit-transform: scale(1.2, 1.2); /* Safari */ transform: scale(1.2, 1.2);
}
.without-scale { -webkit-transition-duration: 1s; /* Safari */ transition-duration: 1s; -ms-transform: scale(1, 1); /* IE 9 */ -webkit-transform: scale(1, 1); /* Safari */ transform: scale(1, 1);
}
.media-object { width: 64px; height: 64px;
}
.panel-primary { opacity: 0.2;
}
.fullopactity { opacity: 1 !important;
}

Twitch.tv API Query - Script Codes JS Codes

var app = angular.module('myApp' , []);
app.controller('TwitchController' , [ '$scope' , '$timeout' , function($scope , $timeout){ $scope.userlist = []; $scope.getStatus = function(status){ return status ? ("label-success") : ("label-danger"); } $scope.getText = function(status){ return status ? ("Online") : ("Offline"); } $scope.$watch('search' , function(){ console.log("has changed"); $.each($scope.userlist , function(){ var data = this; $("." + data.class).animate({ opacity: 1} , 1000); $("." + data.class).on('mouseover', function(){ $(this).addClass('scale'); $(this).removeClass('without-scale'); }); $("." + data.class).on('mouseout', function(){ $(this).removeClass('scale'); $(this).addClass('without-scale'); }); }) }); //$scope.search = ""; //sync request $scope.index = 0; $.getJSON('https://api.twitch.tv/kraken/channels/freecodecamp/follows?direction=DESC&limit=105', function(data) { console.log(data); //if channel is null, user is offline $.each(data.follows , function(){ //console.log(this); var user = this.user; //get follow var name = user.name; //your name //add new user to list $.getJSON('https://api.twitch.tv/kraken/channels/' + name ,function(data){ console.log(data); if(!data.logo) data.logo = "https://static-cdn.jtvnw.net/jtv_user_pictures/xarth/404_user_70x70.png"; if(data){ $scope.$applyAsync(function(){ data.class = "user" + $scope.index; $scope.userlist.push(data); console.log(data.class); $timeout(function(){ console.log("timeout"); $(".user" + $scope.index).animate({ opacity: 1 } , 1500 , function(){ console.log("animate end"); $(".user" + $scope.index).addClass("fullopactity"); }); $(".user" + $scope.index).on('mouseover', function(){ $(this).addClass('scale'); $(this).removeClass('without-scale'); }); $(".user" + $scope.index).on('mouseout', function(){ $(this).removeClass('scale'); $(this).addClass('without-scale'); }); $scope.index++; } , 100); }) } }); }) //https://api.twitch.tv/kraken/streams/dpismenny //https://api.twitch.tv/kraken/streams/freecodecamp?callback=? //https://api.twitch.tv/kraken/channels/freecodecamp/follows?direction=DESC&limit=25 //https://api.twitch.tv/kraken/users/freecodecamp?client_id=5j0r5b7qb7kro03fvka3o8kbq262wwm //https://api.twitch.tv/kraken/beta/streams/random });
}]);
Twitch.tv API Query - Script Codes
Twitch.tv API Query - Script Codes
Home Page Home
Developer Paulo Sérgio
Username paulo101977
Uploaded November 19, 2022
Rating 3
Size 3,631 Kb
Views 22,264
Do you need developer help for Twitch.tv API Query?

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!

Paulo Sérgio (paulo101977) Script Codes
Create amazing captions 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!