How to get the stream key for twitch.tv - stream

I write an app for broadcasting to twitch.tv using C++. For that streaming I need to know the user stream key, usually an user gets that key from the page,
http://www.twitch.tv/user_name/dashboard/streamkey
But I would like get it via my app by using the user name/password.
Any ideas?

You will get it here (change "yourtwitch" by your twitch nickname")
http://www.twitch.tv/yourtwitch/dashboard/streamkey
The link simply moved. You can get this link on the main page of twitch.tv, click on your name then "Dashboard".

This may be an old thread but I came across it and figured that I would give a final answer.
The twitch api is json based and to recieve your stream key you need to authorize your app for use with the api. You do so under the connections tab within your profile on twitch.tv itself.. Down the bottom of said tab there is "register your app" or something similar. Register it and you'll get a client-id header for your get requests.
Now you need to attach your Oauthv2 key to your headers or as a param during the query to the following get request.
curl -H 'Accept: application/vnd.twitchtv.v3+json' -H 'Authorization: OAuth ' \
-X GET https://api.twitch.tv/kraken/channel
documentataion here
As you can see in the documentation above, if you've done these two things, your stream key will be made available to you.
As I said - Sorry for the bump but some people do find it hard to read the twitch* api.
Hope that helps somebody in the future.

You may obtain the stream key via the API:
https://github.com/justintv/twitch-api

As of January 2018 the url is https://www.twitch.tv/username/dashboard/settings/streamkey

Related

How do I create an http request from Twilio Studio

I'm technical, but not experienced in coding and could use some help. I need to create an http request from Twilio studio. I am setting up a phone survey for my client and I need to log both voice and number inputs from the call to a database. I already have the database set up externally. It logs responses with an http request from CLI curl. I'm using the following curl request successfully:
curl --data "q=1 -X POST localhost/test.php
When I try to duplicate the same curl request using the http request widget (no http parameters), I only get error 500 back. By the way, I know it's collecting the data correctly with the flow because I've had it collect and then read back to me successfully.
Twilio studio http request.
I have tried adding http parameters instead of putting them in the body as well. Nothing I try works. My guess is that I have a fundamental misunderstanding of http requests and thus can't duplicate it in Twilio.
Any help you could give me would be great! Thank you!
When you add http parameters instead of putting them in the body (see the capture below)
there is a big red "Save" button on bottom left corner, and a gray (hard to see and easy to miss) "Save" link on the right, above the trash bin.
The gray "Save" link needs to be clicked when adding each name/value pair of the parameters.
The red "Save" button is to be clicked at the end when you're done with the http widget.

How do I use the oauth2 access token with the youtube data api

I am able to generate an oauth2 access token (from a refresh token), which I believe should give me the ability to access the youtube data api functionally to delete/upload content.
Using python and the youtube api I need to delete and upload a (new) video to youtube periodically, say hourly.
All google python samples I've found seem to call the "DENY/ALLOW" screen which requires a copy/paste back in the calling app.
I can do this occasionally but otherwise want the process to be automated. I've read about service accounts which, which according to the linked post, are not supported by the youtube api. Offline access et.al. is also mentioned but in somewhat abstract terms i.e. no concrete python examples (that I have yet found). Another source mentioned an http get like below:
"GET access_token=ya29.GlxBBS89....ast987&part=snippet&mine=true"
but the following in python doesn't seem to work returning "response [400]" (bad request)
url = 'https://www.googleapis.com/youtube/v3/channels'
args = 'access_token: ' + token var + ', part: snippet, mine: true'
get_token = requests.get(url, data = args)
I have used Can we use google youtube data api without OAuth (and others) to get to this stage but need clarification for the next step.
**********************************Update*********************************
I have found that I can only generate access tokens for clients credentials configured as web apps. I am writing a desktop app so I may be barking up the wrong tree.
Or learning Django...
I found examples at https://developers.google.com/youtube/v3/guides/auth/installed-apps that helped.
curl -H "Authorization: Bearer <access_token>" https://www.googleapis.com/youtube/v3/channels?part=snippet&mine=true
curl https://www.googleapis.com/youtube/v3/channels?access_token=<access_token>&part=snippet&mine=true
The curl samples especially provided confirmation that I'm reaching the endpoint and returned helpful debugging info. They have exposed other issues which I'll ask in another question.

Its possible to set fields values of a site and submit then with a Programing Language?

I have this site:
https://acad.unoesc.edu.br/academico/login.jsp
And I want to put info in the fields values and submit then, to get the next page and navigate in that site. Thats because I want to create an android app or something like that. Im using lua in first case, with luasocket(http).
I know that the input has its names, but I dont know how to set then and send then to the server. If someone can help me with this.
Thank you.
You can use POST method with luasocket. See the official documentation and a detailed example in this SO answer.
Since you seem to be doing authentication, you'll probably need to save the cookie value returned to you as part of the login response and then pass that cookie back to the server (otherwise your subsequent requests will fail as the server will reject those requests as non-authenticated).
Since you are sending this over https, you'll need to use LuaSec, which provides ssl.https module as replacement for the http module that luasocket provides. You may check my blog post for some example of how this can be done.

How to I access a SoundCloud public stream?

How do I play a track from a SoundCloud URL, which, for example, I got from the xml response from a query
<stream-url>https://api.soundcloud.com/tracks/31164607/stream</stream-url>
I should have thought that it would have been as easy as:
https://api.soundcloud.com/tracks/31164607/stream&client_id=my_client_id
yet I get
<error>401 - Unauthorized</error>
All I want to do is consume it in a Silverlight MediaElement, so all I need is set some url to the MediaElement's Source property.
I've checked an application that I wrote about 2 years ago, and THEN, accessing the stream url was as easy as this for a public track:
http://api.soundcloud.com/tracks/18163056/stream&consumer_key=MY_CONSUMER_KEY
however this no longer seems to work.
For example, all I had to do then in C# was:
MediaElement me = new MediaElement();
me.Source= new Url("http://api.soundcloud.com/tracks/18163056/stream&consumer_key=MY_CONSUMER_KEY");
me.Play();
Any hints would be appreciated.
I had a reply on a Microsoft forum that seems to imply that SoundCloud might not be possible to stream to Windows 8 Metro devices without consuming the whole stream before playback starts - which is quite worrying and would seem to imply that to make authentication possible, it would have to be done entirely in the url querystring insterad of using the header:
(The following reply is the answer to the following question: 'I am able to access an audio stream by http using the MediaElement, however I need to access it via https in which I need to add the oAuth info to the header of the initial request.
How is this done when using a MediaElement, and if it cannot be done, what is the workaround for consuming an audio feed in Metro 8 that requires header authentication to stream?')
"Direct access to the underlying network stream is not currently permitted by the MediaElement. Because of this there is currently no way to modify the header of the HTTP request to include any additional authentication information. That said, you do have control over the URL. You could theoretically setup an HTTP proxy service that translated the HTTP GET request parameters into the necessary oAuth credentials. Keep in mind that this is just a theoretical workaround. You may find different behavior in practice. Another theoretical workaround would be to handle the oAuth yourself via a raw stream socket and pass the retuned media data to the MediaElement via "Set Source" and a "Random Access Stream". Please keep in mind that this method has major limitations. in order to use a "Random Access Stream" with the ME you need to make sure all of the data is available before passing it to the ME."
The proxy service is not scalable for an application that is merely distributed for free as every stream would need to come via the proxy. And the raw stream socket, although getting around this, would mean that playback could not start until the whole file had downloaded - and this goes against all current UX (User Experience) guidelines.
So once again, if anyone has any tips, or info about how the whole authentication thing can be achieved in a querystring instead of using headers, I'd appreciate it!
I'm a little confused about whether you're referring to a public or a private track? If it's a public track, then you shouldn't need to send any authentication information, just your client id.
When I request https://api.soundcloud.com/tracks/31164607/stream?client_id=YOUR_CLIENT_ID then I get a 302 redirect to the proper mp3 stream.
Remember, adding parameters to a URL must start with a ? not &. This could (more than likely) be the reason why you are getting a 401 (SC is not picking up the client_id).
After authentication the link like this
http://api.soundcloud.com/tracks/103229681/stream?consumer_key=d61f17a08f86bfb1dea28539908bc9bf
is working fine. I am using Action Script.
I'm following up on Tom's reply because he calls attention to url character specificity. My HTTP requests randomly started failing today, and I was prefacing my client_Id with a ?. As soon as I changed that single ? to &, it started working. So in my case, SC wasn't picking up my client_Id because I used the wrong character. I think depending on where in the request we're talking about specifically, it's worth noting that differences between ? and & do make a difference.

Signing twitter user stream request with OAuth

I'm trying to sign a request with OAuth. I read a lot of articles on it, but I don't know how to actually use it right now.
I have this URL: https://userstream.twitter.com/2/user.json And I want to call it for a certain user. I have an app (with Consumer key en secret) and the API key for the account I want to use. So the only thing left to do is sign it.
I used this page: http://hueniverse.com/2008/10/beginners-guide-to-oauth-part-iv-signing-requests/ and got a code block that looked like this one:
GET /photos?size=original&file=vacation.jpg HTTP/1.1
Host: photos.example.net:80
Authorization: OAuth realm="http://photos.example.net/photos",
oauth_consumer_key="dpf43f3p2l4k3l03",
oauth_token="nnch734d00sl2jdk",
oauth_nonce="kllo9940pd9333jh",
oauth_timestamp="1191242096",
oauth_signature_method="HMAC-SHA1",
oauth_version="1.0",
oauth_signature="tR3%2BTy81lMeYAr%2FFid0kMTYa%2FWM%3D"
However, cURL does not accept that. How do I construct something that will work with cURL?
Thanks in advance
EDIT: I don't really need cURL, just comething that I can use with C++ on GNU/Linux
When I've curled a Twitter request from the (Windows) command line, and had to add an OAuth authorization header, I've done it like this:
curl -k "https://userstream.twitter.com/2/user.json" --header "Authorization: OAuth realm=""Twitter API"",oauth_consumer_key=""dpf43f3p2l4k3l03"",oauth_token=""nnch734d00sl2jdk"",oauth_nonce=""kllo9940pd9333jh"",oauth_timestamp=""1191242096"",oauth_signature_method=""HMAC-SHA1"",oauth_version=""1.0"",oauth_signature=""tR3%2BTy81lMeYAr%2FFid0kMTYa%2FWM%3D"""
Of course, if you're using that Java applet, be sure you've set the time as close to the correct time as possible, specified your OAuth credentials, and set the URL part appropriately before substituting the output values into the command line above.
Method: GET
URI Scheme: https
Host Name: userstream.twitter.com
Port: 443
Request Path: /2/user.json
Parameters: [remove all]
Note in the header output that you must manually change the realm to Twitter API, but all the other output values should be correct.
Additionally, this answer has a good selection of C++ Twitter libraries you could try, although the link to the Twitter documentation that lists is out of date -- here's the latest.

Resources