How to get anonymous list of live streams by game - youtube-livestreaming-api

I run the LiveStreamBrowser family of Chrome extensions, which display listings of currently live streams for popular games. I'd like to include YouTube Gaming as a provider, but I can't find a way in the API to do so.
liveBroadcasts/list and liveStreams/list both seem like they'd have the information I need, but neither seems to be returning anything when I use the test on the API page. liveStreams/list also complains about a missing filter parameter, when there's not one documented.
Further, I need an API that is callable directly from JavaScript. For example, Twitch's /streams API, which is called with a 'game' parameter and an API key.
Am I just missing something in the API documentation?

I don't think there is an API exposed for gaming live streams specifically. You can use the Search/list endpoint of the regular YouTube v3 API and filter the results return live content. From there, you could break down the results even more, searching by the game title.
part -> snippet
eventType -> live
type -> video (required when setting eventType to live)
HTTP GET https://www.googleapis.com/youtube/v3/search?part=snippet&eventType=live&type=video&key={YOUR_API_KEY}

Related

How to call Google NLP Api from a Google Chrome extension

My aim is to select some text from a web page, start a google chrome extension and give the text to a google cloud api (Natural Language API) in my case.
I want to do some sentimental analysis and then get back the result to mark/ highlight positive sentences in green and negative ones in red.
I am new to this and do not know how to start.
The extension consists of manifest, popup etc. How should I call an API from there that does Natural Language Processing?
Should I create a Google Cloud Application with an API_KEY to call? In that case I would have to upload my credentials right?
Sorry sounds a bit confusing I know but I just don't know how I can bring this 2 things together an would be more than happy about any help
The best way to authenticate your app will depend on the specific needs and use cases of your application. You can see an overview of all the different methods here.
If you are not planning on identifying users nor on using a back end server that handles authenticating (as I assume to be your case), the best option would indeed be to use API keys. They do not identify the user, but are enough for the Natural Language APIs.
To do this you will need to create an API key for the services you want and add the necessary restrictions to make the key as secure as possible. Detailed instructions on how to do this and how to use the key in a url can be found here.
The API call could be made from within the Chrome extension with any JavaScript method capable of performing POST requests. For example using XMLHttpRequest or the Fetch API. You can find an example of the parameters that need to be included in the request here.
You may run into CORS issues when making the request directly from the extension. I recommend reading this answer, where a couple of workarounds for these issues are suggested.

How to write Spotify API in processing?

For my project in college I have decided to make an interactive map where, when the user hovers over a country the title of the top song in that country is displayed. I wanted to get that title from Spotify charts.
I have read every single page of the Spotify API guide and I am still confused as to how should I write the query in processing. I have the authorisation code and the OAuth token, but I'm not sure how should I include it in the actual sketch.
I really need all the help I can get, I am very new to this and I will appreciate every bit of advice.
Use a Spotify API Java Wrapper such as this one to handle API requests to Spotify.
Wrappers are external libraries that simplify API interfacing by providing functions that you can call from your code to make API requests. See this webpage for information about including external libraries in Processing sketches if you haven't done this before.
The most-played track per country isn't likely to change during operation of your program so requesting (it seems you've identified the correct API endpoint for this) the top track for each country just once is sufficient. This process could be done in setup(), for example, since it runs once only.
Then it's a matter of storing the data from these requests in some sort of data structure to allow your program to retrieve the most played track of the country that is being hovered over. A HashMap of country name to top track is appropriate, but there are many viable approaches.

Retrieve Steam game data using API request

I'd like to know how to create an API call to the Steam web API in order to retrieve all the relevant data for a specified game. I found an example call that almost does what I need, except this call requires you to know the Steam app ID as you can see below:
http://store.steampowered.com/api/appdetails/?appids=730
As you can see if you click on the link, all the information I need is returned with the API call. However I'd like to know if it's possible to modify this API call so that it returns the required information using the game name rather than the Steam ID number?
Unfortunately I don't think this is possible (although the lack of official documentation of the API means I may be wrong).
Firstly, from a design perspective it probably wouldn't work - games could have the same name and so name is not a unique enough reference to identify an item (which is a fundamental concept of a correctly designed REST API).
Secondly, all examples (such as this here) I have come across on the web of people self-documenting the API use appID to identify a game/software and have found no cases of being able to use name. The other documented Steam DEV APIs also use AppId

Are there any methods in Spotify API that can auto-correct search keywords?

I am planning to use the Spotify API to fetch some data, feeding track name and artist as search keywords. However, the track name and artist data I have some parsing errors, and I was wondering if there are any methods in Spotify API that auto-corrects the keywords.
For example, Google will fetch me documents about Radiohead even if I search for 'Radiohea','Radihead', and so. Also, the Last.fm API provides a method named 'track.getCorrection', which does jobs similar to those I explained above.
Here is the explanation of the method from the official Last.fm API website:
'Use the last.fm corrections data to check whether the supplied track has a correction to a canonical track.'
Does anyone know if such method exists in Spotify API?
No, there's no auto-correction engine. The closest Spotify gets to having a search engine is the search endpoint:
You can search, for instance, like this:
query = 'radio head'
and then
query_results = sp.search(q=query, type='playlist')
would return
...u'playlist'...{u'name': u'Air/Zero 7/Thievery Corp/Radio Head/Massive Attack/Morcheeba',...
but that requires that the playlist user spelled it wrong too. That is as far as a typo can get you, I'm afraid.
A workaround is fetching the artist using the last.fm API, use its auto-correction tool and then feed this result into Spotify API, either using artist, track or search endpoints.
I highly recommend you using more than one API for your app, as each one has its own limitations.

Clarify the meaning of APIs

An application-programming interface (API) is a set of programming instructions and standards for accessing a Web-based software application. Could someone explain to me in case of Google maps or Youtube which is the API and which is the software application? Are both visible to us and how? I know there are tons of articles out there, however I cannot clarify the above. APIs are like the waiters that transfer data among different machines. Okay, which exactly is the Google maps API and how do we call/use it? And which is the Google maps software application which is accessed by the API? When we write for example http://maps.google.co.uk/ do we call the API? My query may seem silly but I cannot find a good answer for that.
An application-programming interface (API) is a set of programming
instructions and standards for accessing a Web-based software
application.
Firstly, an API is not just for web-based software. Even your computer's OS provides APIs for hardware and software installed in the box.
For your question, an API is a method (code instructions) to connect your application to the features of another system. Allowing your application to use thay system's features as provided via the API.
Could someone explain to me in case of Google maps or Youtube which is
the API and which is the software application?
In the case of Youtube... Let's say you are making some Android video player app that you also want to be able to playback Youtube videos within that app. The software application is your own Android player code and to access the Youtube data you would use Youtube's Android API.
An example of using the API is this module : YouTubePlayer which as you can see provide API commands like loadVideo(String videoId, int timeMillis). Where videoId is the Youtube ID and timeMillis is the desired start time within the video).
When we write for example http://maps.google.co.uk/ how do we call the
API?
That's not how you would call the API. You must first visit the documentation of the API to see how it's expected to call features within your own app.
Google Maps : https://developers.google.com/maps/documentation/
Let's assume now you're coding a Javascript app, you can see the commands here as a startng point. There is also an example page showing code & result.
Simple terms:
API = the waiter
Application Software = the chef
You order from the waiter. The waiter brings it to the chef. The chef prepares the food. The waiter then brings you your food. Then you figure out what to do with the food; eat it, take it home, throw it on the floor, let your dog eat it, give it the homeless, etc...
A website, app, etc... would send an API request (your order with the waiter) to Google Maps (the chef). If your API request is valid, Google Maps will send back an response (your cooked food with the waiter). Then the website or app takes the returned data and displays it in their custom way to you.
In the case of Google Maps, apps like Yelp and others use Google Maps' API to request specific data; routes, addresses, etc… and then they display it on their app.
To make an API request/call you have access to use the API, format it correctly, and figure out what to do when Google sends a response back : https://developers.google.com/maps/documentation/
API is a set of functions and procedures that allow the creation of applications which access the features or data of an operating system, application, or other service.
An API is like building block for your application. Multiple API's can exchange data without knowing the other's implementation. In a good design pattern , we should design API's for different independent tasks and then merge them.
Google Maps API
This is the google maps API which a developer can use to develop his own piece of software.
Whenever we use any software and it's different features, we might be using their API's without generally knowing of them.
A software application is always visible to us, but an API is visible only if the developer wants to expose it for community use.
EDIT
Using Google maps API
This link has the documentation and examples on how to use the google maps API using javascript.
Hope it helps!
When you use software, web applications included, you are in most cases using a wrapped API. Software developers took the time to take a raw back end API which executes commands on the system, and made these endpoints easy to use for a specific user in an intended universe of discourse, or domain. End users do not have direct access to everything the API has to offer all at once, so it is not "available" in the same sense that it is available to the developers, but it is available in another sense because they are using the API to execute commands on the system by virtue of the Application that was Programmed with that Interface existing and working.
The Google Maps API is used to integrate the power of Google Maps into almost any application. It provides facilities for customization and much more. When you use the Google Maps webapp, it is, to my knowledge, built using many components of the Google Maps API, as are the Google Maps apps for any other platform, such as Android. Does this mean you as a user are using the API? Only through the application; the application talks to the API for you.
“An application programming interface (API) is a set of routines, protocols, and tools for building software applications. An API expresses a software component in terms of its operations, inputs, outputs, and underlying types. An API defines functionalities that are independent of their respective implementations, which allows definitions and implementations to vary without compromising each other. A good API makes it easier to develop a program by providing all the building blocks.
APIs often come in the form of a library that includes specifications for routines, data structures, object classes, and variables. In other cases, notably SOAP and REST services, an API is simply a specification of remote calls exposed to the API consumers.
An API specification can take many forms, including an International Standard, such as POSIX, vendor documentation, such as the Microsoft Windows API, or the libraries of a programming language, e.g., the Standard Template Library in C++ or the Java APIs.
An API differs from an application binary interface (ABI) in that an API is source code-based while an ABI is a binary interface. For instance POSIX is an API, while the Linux Standard Base provides an ABI”.
To speak plainly, an API is the messenger that runs and delivers your request to the provider you’re requesting it from, and then delivers the response back to you.
To give you a familiar example, think of an API as a waiter in a restaurant.
Imagine you’re sitting at the table with a menu of choices to order from, and the kitchen is the provider who will fulfill your order.
What’s missing is the critical link to communicate your order to the kitchen and deliver your food back to your table.
That’s where the waiter (or API) comes in. ”AHEM”
The waiter takes your order, delivers it to the kitchen, and then delivers the food (or response) back to you. (Hopefully without letting your order crash if designed correctly)
Now that we’ve whetted your appetite, let’s apply this to a real API example. In keeping with our theme, let’s book a flight to a culinary capital – Paris.
You’re probably familiar with the process of searching for airline flights online. Just like at a restaurant, you have a menu of options to choose from ( a dropdown menu in this case). You choose a departure city and date, a return city and date, cabin class, and other variables (like meal or seating, baggage or pet requests)
In order to book your flight, you interact with the airline’s website to access the airline’s database to see if any seats are available on those dates, and what the cost might be based on certain variables.
But, what if you are not using the airline’s website, which has direct access to the information? What if you are using online travel service that aggregates information from many different airlines? Just like a human interacts with the airline’s website to get that information, an application interacts with the airline’s API.
The API is the interface that, like your helpful waiter, runs and and delivers the data from that online travel service to the airline’s systems over the Internet.
It also then takes the airline’s response to your request and delivers right back to the online travel service .
And through each step of the process it facilitates that interaction between the travel service and the airline’s systems - from seat selection to payment and booking.
So now you can see that it’s APIs that make it possible for us all to use travel sites. They interface with with airlines’ APIs to gather information in order to present options back to us
The same goes for all interactions between applications, data and devices - they all have API’s that allow computers to operate them, and that's what ultimately creates connectivity.
API’s provide a standard way of accessing any application, data or device whether it is shopping from your phone, or accessing cloud applications at work.
So, whenever you think of an API, just think of it as your waiter running back and forth between applications, databases and devices to deliver data and create the connectivity that puts the world at our fingertips. And whenever you think of creating an API,
--MuleSoft