Youtube [Data-API] LiveChat where logged-in user is moderator - php

I'm trying to work out how i get a list of videos/streams where the user is a moderator for live chat.
This is done in nightbot and fussbot but i can't work out how they do it, it works by you adding the Nightbot channel as a moderator of your live streams chat but im unsure how they get your live stream to watch the chat from them being added as a moderator to the channel. (i'm guessing they are a channel moderator and not a video/stream as they are persistent though all casts)
I have thought it would be in the API docs but if it is i can't find it / not sure what im looking for.
I'm implementing this in PHP and so far i have it now getting stream events id's and your persistent live stream ids but i'm now stuck.

I don't think the API supports a way to retrieve a list of chats where the logged-in user is a moderator. The liveChatModerators.list method requires that a value be set for the liveChatId parameter, and that value must specify a single live chat ID.
I'll caveat the following by saying that I'm not familiar with the apps you mentioned or how they work, so this is just conjecture. Your question describes a third-party app that lets you (or helps you to) manage YouTube live chats. Presumably, to use the app, you must have granted that app permission to manage your YouTube account.
With that in mind, if you set up a live stream through that app, then the app could, while creating the live stream, also use the liveChatModerators.insert method to add its own channel as a moderator to the live stream's chat. Similarly, the app could retrieve your list of live streams and add its own channel as a moderator to any of those live streams. The app could use its own data store to determine whether its channel had already been added as a moderator for any particular chat.
Please post a comment in reply if you don't think I'm understanding your question.

Related

Display current song Web API

I am looking to display the current song I am listening to on Spotify. There is an endpoint to obtain this here (Spotify Web API Player) which requires authentication through the Spotify web API.
If I have obtained a Client ID and Client Secret from my app settings, which authentication type is suited to my needs?
I've looked here (Spotify Authorization Flows) but from my understanding and confusion, I believe this cannot be done as the request for authentication would be to authenticate the user against my app and display their current song and not mine.
Fundamentally, I'm looking for a way to display my current song without the end user having to request access to my app but instead, the app uses my details.
Thanks in advance.
Arielle from Spotify here.
The Authorization Code Flow is what you're looking for, but you are correct that in a standard implementation users would see their own data (which makes sense - you usually don't want users seeing other users' data)
However, you can set it up such that you're the only one who authenticates and only your data is shown. I actually made an app to show my currently playing track a little while back. Check it out on Glitch here: https://glitch.com/edit/#!/ari-currently-playing
You can simply start editing the project to "remix" it and make your own version!
Hope this helps, let me know if you run into any issues!

how to post on google plus page stream using php/curl?

I want to post on google plus page stream using php, I checked google plus api but didn't found anything, read a post where it was saying that you can't post because google only provided read permission. When I googled I saw nextscripts SANP API to post on social networks.
If google only provided read permissions then how nextscripts is able to post?
SNAP is a paid API & I want to create my own code to do the same.
Is there anything I am missing. please guide me.
Short answer: There is no way to create a post that appears in a Google+ stream.
Medium answer: Google doesn't provide an API to post to a "normal" user's page. There are APIs that allow a website to let a user post something, and they can suggest text to post, but the user must take an explicit action. There have been attempts to use unauthorized APIs to do this, but they try to intercept the above procedure and aren't reliable. Depending on your exact needs, there are other alternatives as well.
Long answer: Depending on your exact needs, there may be some APIs which can help. But keep in mind they only apply to specific, sometimes very narrow, circumstances:
Are you trying to post to a page, not a user? There is the Google+ Page API which is available to partners only. This may be what the netxtscripts SNAP API is using - I don't know. This is what HootSuite uses, for example. You can request access at https://developers.google.com/+/api/pages-signup, but they don't approve many applicants.
Are you trying to post on behalf of a Google Apps user for other users in the same domain to see? If so, there is the Domains API at https://developers.google.com/+/domains/
Are trying to post an activity or action? Like the user listening to a song or eating at a restaurant? You may benefit from App Activities with the Moments API. These don't go directly into the stream, but are available through Search, in the user's profile in some limited ways, and they can reshare them into the stream if they wish. https://developers.google.com/+/features/app-activities
Let a user post to their stream from a web page? This still requires specific action by the user, so they have to approve what you're saying, but you can use something like normal share, +1, or interactive post buttons. https://developers.google.com/+/features/interactive-posts
You just want your server to post a plain old normal message to a normal user's stream without a person having to do anything? You can't do that.
There is still no way to post on a Google+ stream using an API. For details on what you can currently do with the limited API you can look at Google+ api
There is an issue request for this from as far back as 2011: Write access to the streams

Mass Wall Post to multiple users?

I have a contest App. And many users have installed the app. I have stored the offline_access tokens of these users. I want to send a message to all users of app at the end of contest. What is the best way to do it. Because when I do it in a while loop the page never loads and browser just shows loading animation gif on tab.
You don't even need the user access tokens to accomplish something similar to what you're trying to do.
First off, mass-wall posting is both a violation of the Facebook Platform Policies (specifically IV.2, IV.3), but it's also really spammy and users will react negatively, probably blocking your app and ultimately it may get banned from Facebook. So don't do that.
Instead, you should utilise the intended social channel for notifying users of new content, App to user Requests.
This is pretty simple to do, as per the Graph API docs for apprequests you just make the following API call:
https://graph.facebook.com/USERID/apprequests?app_access_token=APPTOKEN
Where USERID is each user's Facebook ID and APPTOKEN is always your applications unique access token (see the documentation here if you do not know how to obtain one of those). You will also need to include parameters such as message, which you can read more about in the docs.

Get facebook posts/events/news/gallery with javascript (or php) inside my website

I'm tryin to develop a (almost) 100% client-side dynamic website by integrating it with twitter, facebook and flickr.
I've been able so far to get the last 4 tweets (with javascript) from my client's feed, and now i was wandering if i could do the same with facebook's gallery and events from their feed.
Especially, what i need (given the facebook username/api key/whatever)
gallery
for each gallery in user's profile:
get the gallery name
get the first picture
get the gallery url
news/events
for each news/event/post in user's profile:
get the event name
get the event text
get the event picture (if provided)
get the event url
I don't want to use the facebook widgets with their rendering, i just need to read the json response (if there's any) and put the data inside my website (like a preview).
Since my client is pretty rusty with "computers (cit.)" but he's (not so strangely) comfortable with facebook/twitter/flickr, i tought about a solution like this before adding a database and an admin interface to our website.
I found some resources online, so i think it's possible (in a way or another). I'd like to do it in javascript, but if it's php i won't complain.
Check out this API to get photoes from the user profile
http://developers.facebook.com/docs/reference/api/album/
This is for events
http://developers.facebook.com/docs/reference/api/event/
You can use either the PHP or the Javascript API SDKs:
http://developers.facebook.com/docs/reference/php/
http://developers.facebook.com/docs/reference/javascript/
respectively. Naturally you would handle the returned information differently. Both have a method called api() which can be utilised to grab the album and event objects (as mentioned in another answer):
http://developers.facebook.com/docs/reference/api/album/
http://developers.facebook.com/docs/reference/api/event/
You can pass parameters in the methods to restrict the results returned by fields, number of items, sizes of images etc. This is outlined here:
http://developers.facebook.com/docs/reference/api/
But the issues you are going to face is that you have to authorise your "app" - think website when they use the terminology "app" - to give it permissions to access the information. This takes the form of a two step process. You have to create the app on the Facebook platform which can then access the API methods (only certain information can be got from the API methods without an authenticated app).
The second part is that the user themselves must then authenticate their facebook account against your app - this gives your app permission to access the user's information. In plain English it would go like this:
User visits your webpage; user must be logged into Facebook and must approve your app (this used to be called Facebook Connect for obvious reasons); the app and the user account are "connected"; the app can then use the api methods you've written to return information about the connected user
The beginning explanations of how to do this are here:
http://developers.facebook.com/docs/authentication/
The only way you can access a user's (non-public) information from outside of Facebook is via a connected app and user profile.

Get real-time notification from Facebook for user updates

I am building a website app using Facebook PHP API. My current scenario is I want my server side to get updates from Facebook when a user of mine app(he already give the access_token) has some updates. e.g.: if the user post a comment, if someone post a comment on his wall, send him a message, I wish in my server side I can get this notification.
I have checked out the graph API's realtime updates, but I didn't get if I can use the realtime updates to do the above tasks. I wonder if someone know if the realtime updates can do this or not.
The second solution would be: since I have the access_token, I can periodically check the information of the user to see if there is any new updates. The disadvantage of this approach is that it puts lot of heavy on my server side.
The real-time updates API documentation says:
"You can't subscribe to these user connections yet: home, tagged, posts, photos, albums, videos, groups, notes, events, inbox, outbox, updates, accounts. We will add support for more properties and connections in the future."
The three examples you listed are all not available at the moment. For now, you will need to poll the Graph API every so often to check. You will want to prompt the user for offline_access extended permission to be able to check this later after they leave your site.

Categories