cannot get RTMP URL and stream key - youtube

I am developing code using the youtube API for live streaming. What I have done
I have registered a project in google and gotten client_id, client_secret, and
developer ID
I have done OAuth 2.0 and gotten the code and exchanged it to AUTH_TOKEN
I can create a live event by posting to domain gdata.youtube.com
with request
/feeds/api/users/default/live/events
with header
Authorization: Bearer AUTH_TOKEN
GData-Version: 2
Content-Type: application/atom+xml
X-GData-Key: key=DEV_ID
with content
<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns='http://www.w3.org/2005/Atom'
xmlns:media='http://search.yahoo.com/mrss/'
xmlns:yt='http://gdata.youtube.com/schemas/2007'>
<title>Test</title>
<summary>Test gogogogo!</summary>
<content type='application/atom+xml'>
<entry>
<yt:private/>
<yt:cdn name='primary'>
<media:content yt:format='18'/>
<media:content yt:format='19'/>
</yt:cdn>
</entry>
</content>
<yt:when start='2013-07-05T22:00:00.000Z'/>
</entry>
This returns HTTP code : 201 and my live event is created, but the returned data
does not include STREAM KEY AND RTMP URL. I need these data to start my live
event automatically.
the return data
<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns='http://www.w3.org/2005/Atom'
xmlns:app='http://www.w3.org/2007/app'
xmlns:media='http://search.yahoo.com/mrss/'
xmlns:gd='http://schemas.google.com/g/2005'
xmlns:yt='http://gdata.youtube.com/schemas/2007'
gd:etag='W/"CkEHR347eCp7I2A9WhFQEE0."'>
<id>tag:youtube.com,2008:live:event:XXXXXXXXXXXXXXXXXXXX</id>
<published>2013-07-05T05:03:56.000Z</published>
<updated>2013-07-05T05:03:56.000Z</updated>
<app:edited>2013-07-05T05:03:56.000Z</app:edited>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://gdata.youtube.com/schemas/2007#liveEvent'/>
<title>Test</title>
<summary>Test gogogogo!</summary>
<content type='application/atom+xml'
src='http://gdata.youtube.com/feeds/api/users/XXXXXXX/live/videos/XXXXXXXXX'/>
<link rel='self' type='application/atom+xml'
href='http://gdata.youtube.com/feeds/api/users/XXXXXXXXXXXXXXX/live/events/XXXXXXXXXXXXXXXXXX'/>
<link rel='edit' type='application/atom+xml'
href='http://gdata.youtube.com/feeds/api/users/XXXXXX/live/events/XXXXXXXXXXXXXXXXXXXXXX'/>
<author>
<name>XXXXXX</name>
<uri>http://gdata.youtube.com/feeds/api/users/XXXXXXXXXX</uri>
<yt:userId>XXXXXXXXXXXXX</yt:userId>
</author>
<media:group>
<media:description type='plain'>Test gogogogo!</media:description>
<media:title type='plain'>Test</media:title>
</media:group>
<yt:status>pending</yt:status>
<yt:when start='2013-07-05T22:00:00.000Z'/>
</entry>
If I manually login youtube and click on my create live event, I can see my
stream key and RTMP URL there. And I can use they to start streaming manually
So my problem is: how can I get STREAM KEY and RTMP URL automatically (by API
request)?
----EDIT----
based on https://developers.google.com/youtube/2.0/developers_guide_protocol_managing_live_events
it said that when I success create/adding an event, youtube will returns url like this
<yt:cdn name='primary'>
<media:content yt:format='19' yt:name='yt-live_SpQXZYILnN0_35'
url='rtmp://rtmp1.youtube.com/videolive?...'/>
</yt:cdn>
but in my case, my returned data doesn't include this line

After do some research, I solved it by sending this request
/feeds/api/users/default/live/events?inline=true
and the youtube returns me RTMP server URL
Thanks all

Related

Sending a SOAP request using Postman

I'm trying to send a SOAP request to the Loqate services following their API documentation found here.
The documentation says the SOAP end point is
https://api.addressy.com/Capture/Interactive/Find/v1.1/wsdlnew.ws
and the sample request is:
<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<Find
xmlns="http://api.addressy.com/">
<Key>AA11-AA11-AA11-AA11</Key>
<Text>wr5 3da</Text>
<IsMiddleware>True</IsMiddleware>
<Container>GB|RM|ENG|3DA-WR5</Container>
<Origin>52.182,-2.222</Origin>
<Countries>GB,US,CA</Countries>
<Limit>10</Limit>
<Language />
<Bias />
<Filters />
<GeoFence />
</Find>
</soap:Body>
</soap:Envelope>
So I load up Postman and make these steps, following the Postman guide from their blog.
When I send the request, I just get back this page . I'm not sure why it's not working.
How can I make a SOAP request to this API? What am I missing?
That's not the service endpoint, it's an address where you can get the WSDL. Inside that WSDL you will find the service endpoint:
<soap:address location="http://services.postcodeanywhere.co.uk/Capture/Interactive/Find/v1.10/soapnew.ws"/>
Send your request there. The endpoint is over http, but the https seems to be working on the same address: https://services.postcodeanywhere.co.uk/Capture/Interactive/Find/v1.10/soapnew.ws
One other thing. If you want a more specific client than Postman, you could try SoapUI.

Batch Delete Videos From YouTube Favorites Playlist

I am trying to batch delete videos from the user his YouTube favorites using the YouTube v2 API. (See also https://developers.google.com/youtube/2.0/developers_guide_protocol_batch_processing)
Posting videos to the favorites in batch works nicely; and I can also remove single videos from the favorites without problem (This rules out a problem with authentication).
My request body is as follows, where VIDEOID1 and VIDEOID2 are the <yt:favoriteId>Ids found in their corresponding video xml:
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns='http://www.w3.org/2005/Atom' xmlns:media='http://search.yahoo.com/mrss/' xmlns:batch='http://schemas.google.com/gdata/batch' xmlns:yt='http://gdata.youtube.com/schemas/2007'>
<batch:operation type="delete"/>
<entry><id>VIDEOID1</id></entry>
<entry><id>VIDEOID2</id></entry>
</feed>
This is the response I get back however, where UserID ofcourse is the userID of the user and BatchID is the BatchID given by the service:
<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns='http://www.w3.org/2005/Atom'>
<id>https://gdata.youtube.com/feeds/api/users/USERID/favorites/batch/BATCHID</id>
<updated>2014-01-31T14:50:54.948Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind' term='http://gdata.youtube.com/schemas/2007#favorite'/>
<title>Batch Feed</title>
<entry xmlns:batch='http://schemas.google.com/gdata/batch'>
<id>VIDEOID1</id>
<updated>2014-01-31T14:50:54.948Z</updated>
<title>Error</title>
<content>Invalid entry Id/Uri</content>
<batch:status code='400' reason='Invalid entry Id/Uri'/>
</entry>
<entry xmlns:batch='http://schemas.google.com/gdata/batch'>
<id>VIDEOID2</id>
<updated>2014-01-31T14:50:54.949Z</updated>
<title>Error</title>
<content>Invalid entry Id/Uri</content>
<batch:status code='400' reason='Invalid entry Id/Uri'/>
</entry>
</feed>
It states Invalid entry Id/Uri for the videos I try to remove, while when I remove them by singular delete request with the same ID, it works.
Is batch deleting videos from favorites not supported, or am I missing something?
I've got it to work, thanks to this question and answer: Batch deleting videos using YouTube API and HTTpWebRequest
The trick was using the user its userId instead of default, and to use to complete video URL as id.
The batch URL looks like this:
https://gdata.youtube.com/feeds/api/users/USERID/favorites/batch?v=2&alt=json
The request looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns='http://www.w3.org/2005/Atom' xmlns:media='http://search.yahoo.com/mrss/' xmlns:batch='http://schemas.google.com/gdata/batch' xmlns:yt='http://gdata.youtube.com/schemas/2007'>
<batch:operation type="delete"/>
<entry>
<id>https://gdata.youtube.com/feeds/api/users/USERID/favorites/VIDEOID1?v=2</id>
</entry>
<entry>
<id>https://gdata.youtube.com/feeds/api/users/USERID/favorites/VIDEOID2?v=2</id>
</entry>
</feed>

Insert into Google Merchant data feed using Content API

I'm trying to insert some data into my merchant account data feed using the Content API. Using the code below, I've been given a "POST requests require a Content-length header. That’s all we know." error, but I've set the content length, so I'm really confused.
One theory I have is that it doesn't know where to put these requests, under my merchant account ID, I have two data feeds, and I'm not sure how to set it to enter into a given data feed.
The XML is stolen from here: https://developers.google.com/shopping-content/batch-operations
#feed = '<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom"
xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/"
xmlns:g="http://base.google.com/ns/1.0"
xmlns:batch="http://schemas.google.com/gdata/batch">
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:sc="http://schemas.google.com/structuredcontent/2009"
xmlns:scp="http://schemas.google.com/structuredcontent/2009/products"
xmlns:app="http://www.w3.org/2007/app">
<batch:operation type="INSERT"/>
<title>Switch 1</title>
<content type="text">A new item available...</content>
<link rel="alternate" type="text/html" href="http://www.example.com/sku123"/>
<sc:id>SKU123</sc:id>
<sc:content_language>en</sc:content_language>
<sc:target_country>US</sc:target_country>
<scp:google_product_category>Electronics > Networking > Hubs &
Switches</scp:google_product_category>
<scp:condition>new</scp:condition>
<scp:price unit="USD">25</scp:price>
<scp:availability>in stock</scp:availability>
</entry>
<entry xmlns="http://www.w3.org/2005/Atom"
xmlns:sc="http://schemas.google.com/structuredcontent/2009"
xmlns:scp="http://schemas.google.com/structuredcontent/2009/products"
xmlns:app="http://www.w3.org/2007/app">
<batch:operation type="INSERT"/>
<title>Switch 2</title>
<content type="text">Another item available...</content>
<link rel="alternate" type="text/html" href="http://www.example.com/sku124"/>
<sc:id>SKU124</sc:id>
<sc:content_language>en</sc:content_language>
<sc:target_country>US</sc:target_country>
<scp:google_product_category>Electronics > Networking > Hubs &
Switches</scp:google_product_category>
<scp:condition>new</scp:condition>
<scp:price unit="USD">50</scp:price>
<scp:availability>in stock</scp:availability>
</entry>
</feed>'
http = HTTPClient.new
#output = http.post('https://content.googleapis.com/content/v1/<myMerchantID>/items/products/schema/batch', {},"content"=> #feed, "Content-length"=>#feed.length.to_s, "GData-Version"=> "1", "Authorization" => "AuthSub token=myToken", "Content-Type"=> "application/atom+xml")
Are you Authenticating prior to your post?
https://developers.google.com/shopping-content/getting-started/authentication

resumable-create-media link

I'm creating an iOS app that will upload a file to a specific collection in Google Docs. How can I get the resumable-create-media link for that collection?
When I do a get request on the collection as recommended here: https://groups.google.com/forum/?fromgroups#!topic/google-documents-list-api/LOxHfIxVAec
I get the following xml (sadly no resumable-create-media)
<?xml version='1.0' encoding='UTF-8'?>
<entry xmlns='http://www.w3.org/2005/Atom'
xmlns:docs='http://schemas.google.com/docs/2007'
xmlns:batch='http://schemas.google.com/gdata/batch'
xmlns:gd='http://schemas.google.com/g/2005'>
<id>https://docs.google.com/feeds/documents/private/full/folder%3A0B4Xm3k31FF25MXZzbjZvNzhZU00</id>
<published>2012-07-03T14:38:35.068Z</published>
<updated>2012-07-03T14:38:35.068Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/docs/2007#folder' label='folder'/>
<title type='text'>My Collection</title>
<content type='application/atom+xml' src='https://docs.google.com/feeds/folders/private/full/folder%3A0B4Xm3k31FF25MXZzbjZvNzhZU00'/>
<link rel='alternate' type='text/html' href='https://docs.google.com/#folders/folder.0.0B4Xm3k31FF25MXZzbjZvNzhZU00'/>
<link rel='http://schemas.google.com/docs/2007#icon' type='image/png' href='https://ssl.gstatic.com/docs/doclist/images/icon_9_collection_list.png'/>
<link rel='self' type='application/atom+xml' href='https://docs.google.com/feeds/documents/private/full/folder%3A0B4Xm3k31FF25MXZzbjZvNzhZU00'/>
<link rel='edit' type='application/atom+xml' href='https://docs.google.com/feeds/documents/private/full/folder%3A0B4Xm3k31FF25MXZzbjZvNzhZU00/h47320jg'/>
<author><name>xxxx</name>
<email>xxxx#gmail.com</email></author>
<gd:resourceId>folder:0B4Xm3k31FF25MXZzbjZvNzhZU00</gd:resourceId>
<gd:lastModifiedBy><name>stayaway</name><email>xxxx#gmail.com</email></gd:lastModifiedBy>
<gd:quotaBytesUsed>0</gd:quotaBytesUsed>
<docs:writersCanInvite value='true'/>
<gd:feedLink rel='http://schemas.google.com/acl/2007#accessControlList' href='https://docs.google.com/feeds/acl/private/full/folder%3A0B4Xm3k31FF25MXZzbjZvNzhZU00'/>
</entry>
Many Thanks
The Google Drive API has replaced the Documents List API.
A sample Objective-C application that demonstrates use of the Drive API, including uploading and downloading files, is here.

error posting images to my bucket in google cloud storage

I have a bucket with the acl set to Allusers and Full_control, so that users can post and retrieve images from the bucket.
. I have tried using this url (http://commondatastorage.googleapis.com/bucket/+Image.png) to post images from my app; but i get the "error 1104, the image cannot be posted with the url provided.
here is my alc for the bucket:
<?xml version="1.0" ?>
<AccessControlList>
<Owner>
<ID>
00b50024a97592382732e7e69afac5fcba343397379237323e5ebd216831a418023820874872
</ID>
</Owner>
<Entries>
<Entry>
<Scope type="AllUsers"/>
<Permission>
FULL_CONTROL
</Permission>
</Entry>
<Entry>
<Scope type="GroupById">
<ID>
00b4903a2853501162e8e89afac5fcba14239486e5ebd216831a419323059585
</ID>
</Scope>
<Permission>
FULL_CONTROL
</Permission>
</Entry>
</Entries>
</AccessControlList>
This doesn't sound like an ACL problem. Can you try without the + at the beginning of the object name? i.e. image.png rather than +image.png?
Thanks for sending me the source. Your program is written with App Inventor and does not have the Auth token.
App Inventor can get the token, but you need to know what to do.
I am working on documenting that flow for others, I'll work with you to get you going and also follow up with a working example here.
Gary

Resources