I have a program to scrape (almost) all of the comments from a given YouTube video from another SO question, and I am looking to do the same thing for the chat in a livestream. From what I understand, I need to get the liveChatId, and I need to do that with the liveBroadcast function. Additionally, I need to use an OAuth2 key, as opposed to a regular developer key, which I use for the program to get comments from videos. However, I haven't seen a way to get the comments from an arbitrary user's livestream, only my own, and I'd like to get the comments from any livestream I want. Specifically, I'd like to know if this is possible, and if so, what I would need to do to accomplish this.
The reason you are getting The user is not enabled for live streaming is because your account isn't enabled for live streaming. The Live Streaming API will only return results from your own account as far as I can tell.
Related
I'm trying to make it alert me (in console, I am later going to add a discord bot to it) whenever my friend posts to SoundCloud, I would preferably like to get the song link and information about it but I cant do that without getting the basics done.
I've looked through SoundCloud API documentation, and the closest to this is to list the songs.
I don't know where to start.
I'm not a developper but personnaly I would create a database with the actual song of a profile, then check if a new one appeared every x time.
Have you checked really easy solution like Zapier or IFTTT ? They may offer that kind of service. And they can directly make a webhook to a discord bot.
How do you get info from an API the one I want to use is https://nba-players.herokuapp.com/, and when the user asks for a player I take the info from the API and send that? For example, the user says !Steph how do I change the link for Steph Curry's stats and send the info there
You will need to learn how the API returns the data, how to fetch the data within discord.py, and how to process/parse the data and wrap them into a nice, presentable form.
Unfortunately, we can't help you if you haven't gotten any progress. StackOverflow is more of a troubleshooting place; not a how-to-implement-this-idea-101 place.
Generally, the API will return a JSON response. So, you need to make a http request within the discord.py command to the API endpoint, and fetch that JSON response. You can process that data into a python dictionary, then parse the data into a discord.Message object.
If you had a hard time understanding any of those, please do your research in the respective area you had trouble with. It may be intimidating at first to take them all in, but it is actually really intuitive and straight forward.
How-to's:
Python API Tutorial: Getting Started with APIs
discord.py Documentations
I'm having trouble accessing video insights for a page that I'm an admin of. Specifically, I'm looking for these metrics.
I have generated a token that gives me manage_pages, read_insights, and read_stream access. When I use the Graph API tool on Facebook's website with this:
[postID]/insights/post_video_views_organic
I get the views I am looking for. However, when I use the Facebook SDK like so:
graph = facebook.GraphAPI([myUserToken])
graph.get_object('/[postID]/insights/post_video_views_organic')
I get an empty "data" field returned. Does anyone know how to return the data using Python?
PS- should mention, I am able to get regular Insights data using the Python SDK.
I was able to get video insights by refreshing the token again. As I've been playing with this stuff, it seems that access to video insights is much, much more finicky than the regular page insights. With the same call each time, I get an error 50% of the time.
I am looking through the Tweepy API and not quite sure how to find the event to register for when a user either send or receives a new tweet. I looked into the Streaming API but it seems like that is only sampling the Twitter fire house and not really meant for looking at one indvidual user. What I am trying to do is have my program update whenever something happens to the user. Essentially what a user would see if they were in their account on the twitter homepage. So my question is: What is the method or event I should be looking for in the Tweepy API to make this happen?
Don't know much about tweepy, but you should really look into Twitter's API Document here, which describes your need directly.
And I took a look at tweepy but don't seem to find it support the userstream series of Twitter API, maybe you have to wrap it yourself :-)
I don't think there is any event based pub-sub exposed by twitter. You just have to do the long polling.
I used the .filter function then filtered for the user I was looking for.
I am building a website for a comedy group which uses Facebook as one of their marketing platforms; one of the requirements for the new site is to display all of their Facebook events on a calendar.
Currently, I am just trying to put together a Python script which can pull some data from my own Facebook account, like a list of all my friends. I presume once I can accomplish this I can move to pulling more complicated data out of my clients account (since they have given me access to their account).
I have looked at many of the posts here, and also went through the Facebook API documentation, including Facebook Connect, but am really beating my head against the wall. Everything I have read seems like overkill, as it involves setting up a good deal of infrastructure to allow my app to set up connections to any arbitrary user's account (who authorizes me). Shouldn't it be much simpler, given I only ever need to access 1 account?
I cannot find a way to retrieve data without having to display the Facebook login window. I have a script which will retrieve all my friends, but it includes a redirect where I have to physically log myself in to Facebook.
Would appreciate any advice or links, I just feel like I must be missing something simple.
Thank you!
Just posting up my notes on the successful advice, should others find this post;
Per Daniel and William's advice, I obtained the right permissions using the Connect options. From William, this link explains how the Facebook connection works
https://developers.facebook.com/docs/authentication/
This section on setting up the actual authentication was most helpful to me.
http://developers.facebook.com/docs/api
Basically, it goes as follows:
Post a link to the following URL. A user will need to physically click on it (even if that user is just you, the site admin).
https://graph.facebook.com/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=http://www.example.com/HANDLER
This will redirect to a Facebook login, which will return to http://www.example.com/HANDLER after the user authenticates. If you wish to do more than basic reads and news feed updates you will need to include this variable in the above link: scope=offline_access,user_photos. The scope variable just includes a comma separated list of values, which Facebook will explicitly tell the authenticating user about during the login process, and they will have to OK. Most helpful for me was the offline_access flag (user_photos lets you get at their photos too), so I can pull content without someone logging in regularly (so long as I store the access token obtained later)
Have a script located at http://www.example.com/HANDLER that will take a variable from the request (so facebook will redirect to http://www.example.com/HANDLER&code=YOUR_CODE after authentication). Your handler needs to pull out the code variable, and then send the following request:
https://graph.facebook.com/oauth/access_token?
client_id=YOUR_CLIENT_ID&
redirect_uri=http://www.example.com/oauth_redirect&
client_secret=YOUR_SECRET_KEY&
code=YOUR_CODE
This request will return a string of the form access_token=YOUR_ACCESS_TOKEN.
Just parse off the 'access_token=', and you will have a token that you can use to access the facebook graph API, in requests like
http://graph.facebook.com/me/friends?access_token=YOUR_ACCESS_TOKEN
This will return a JSON object containing all of your friends
Hope this saves someone else some not fun time straining through documentation. Thanks for the help!
It is true, that Facebook's API is targeted at developers who are creating apps that will be used by many users.
Thankfully, the new Graph API is much simpler to use than its predecessor, and shouldn't be terribly difficult for you to work with without using or creating a lot of underlying infrastructure.
You will need to implement authorization, but this is not difficult, and as long as you prompt the user for the offline_access permission, it'll only need to be done once.
The documentation on Desktop Authentication would probably be most relevant to you at this point, though you might want to move to the javascript-based authentication once you've got a web app up and running.
Once the authentication is done, all you're doing is making GET requests to various urls and working with the resulting JSON.
Here's the documentation about Events, and you can get a list of friends from the friends connection of a User.
I'm not expert on Facebook/Facebook Connect, however I've seen it used/used applications with it and it seems there's really only the 'official' way to do it. I'm afraid it looks like your best bet would probably be something along the lines of this.
http://wiki.developers.facebook.com/index.php/Connect/Authentication_and_Authorization
Regardless of how you actually 'use' it, you'll still need to authorize the application to connect to the account and this means having a Facebook App as well.
The answer to Facebook application authentication is hard to find but is actually found within the "Analytics" page of the Graph API.
Specify the following: https://graph.facebook.com/oauth/access_token?client_cred&client_id=yourappid&client_secret=yourappsecret , you will then be given an access_token that you may use on all other calls.
The Facebook provided APIs do NOT currently provide this level of functionality.