I have videos embedded on a protected website via the old API.
I want to switch to the new API. All I need is an embed-code for a PRIVATE video.
Normally I would call: http://www.dailymotion.com/services/oembed?url=
But this does not work for a private video.
I already have a mapping-table for the old video-IDs to the new URLs.
I also have an API-Key and API-Secret.
Is there some example code on how to get the embed-URL for a private video via the API with PHP-SDK?
Thanks for help.
To request the embed url you can request the embed_urlĀ field from the api https://developer.dailymotion.com/api#video-embed_url-field
In php, the call is:
$api->get(
'/video/<videoID>',
array('fields' => array('embed_url'))
);
If your video is private, you'll have to use authentication (https://developer.dailymotion.com/api#authentication) to be able to access embed url information. This section https://developer.dailymotion.com/tools/sdks#sdk-php-authentication will shows you how to do this in php.
Related
I tried show captions in the video via URL but It's tell me login required
My attempt
https://www.googleapis.com/youtube/v3/captions/BoaAKQZq5TEG3wdKFklJrnQZ3_7OayFqRJtSUDTo9Ck=?tfmt=ttml&tlang=en&key=I_Hid_My_Key
The result is Login Required
The source
Captions: download
What you need to understand is the diffidence between private and public user data. Public data is just that public anyone can access it. Youtube Video search for example searches for public youtube videos.
Videos captions download Downloads a caption track. The caption track is returned in its original format unless the request specifies a value for the tfmt parameter and in its original language unless the request specifies a value for the tlang parameter.
This data is private data. It can only be accessed by the captions on a video with the permission and Authorization of the owner of the video.. In you are currently using an api key denoted by key= which is only used for accessing public data. You will need to be authenticated using one of the below scopes in order to access this information.
This request requires authorization with at least one of the following scopes (read more about authentication and authorization).
Scope
https://www.googleapis.com/auth/youtube.force-ssl
https://www.googleapis.com/auth/youtubepartner
At least a year ago, if I go to
http://gdata.youtube.com/feeds/api/videos?v=2&max-results=1&q=intitle:"Relapse"+intitle:"Eminem"&orderby=viewCount
from FireFox browser, I could the list of video titles that meet the search query in this address.
But now it doesn't work.
Has it been deprecated?
#user3123767 The YouTube Data API (v2) has been officially deprecated as of March 4, 2014. Please refer to our deprecation policy for more information. Please use the YouTube Data API (v3) for new integrations and migrate applications still using the v2 API to the v3 API as well. Ref
All calls to Google APIs now require that you send Your Api Key, which you can obtain one from Here
Once you got your API Key You can Make various calls
For example Search for videos using the key word "Hollywood"
Run this code and see the result in console
(function($){
function SearchYouTube(queryToSearch,pageToken,ApiKey,maxResults){
var
YoutubeUrl="https://www.googleapis.com/youtube/v3/",
pageToken=pageToken,
maxResults=maxResults,
ApiKey=ApiKey,
$.get(YoutubeUrl+"search?q="+queryToSearch,{
part : 'snippet',
pageToken:pageToken,
key:ApiKey,
maxResults:maxResults
},
function(data) {
//let check if request is granted with our Api Key
if(!data.items[0]){console.log("System Configuration Error");}
//If request granted okay
var
videoId=data.items[0].id.videoId,
videoImgUrl=data.items[0].snippet.thumbnails.high.url,//medium | default | high
videoTile=data.items[0].snippet.title,
nextPageToken=data.items[0].nextPageToken;// Useful if you want the next set of datas
//Display data on page here if you want
//See console Log of results that you can use
console.log(data);//Dump data
}//Success
);
}
//Usage
SearchYouTube("Hollywood","","xxx Your Api Key xxx",5);
//==================All Closed==========
})(jQuery);
See Working Sample Here
could be a few reasons.
YouTube API v2.0 is deprecated not sure if it totally down now or not.
All calls to Google APIs now I think require that you send a at the very least a public API key. I just tested the following
http://gdata.youtube.com/feeds/api/videos?q=skateboarding+dog&start-index=21&max-results=10&v=2&key=[api
key]
It returned
This webpage is not available
I think I am going to have to say that its not working anymore you should try and use YouTube API v3 instead.
Requirement: I am trying to upload videos to my Youtube channel through Youtube Data API for Java. The request is sent from a war file hosted on tomcat container.My application is not for external users and I only use it to upload my own generated videos. With the help of the api documentation and sample youtube code snippets, I have successfully managed to post video on youtube.
Problem: The issue is that whenever I try to run the code, I get prompted for
Please open the following address in your browser:
https://accounts.google.com/o/oauth2/auth?client_id=&redirect_uri=http://localhost:8080/Callback&response_type=code&scope=https://www.googleapis.com/auth/youtube.upload
Since I run this code on a remote server, it is not possible for me to always open this URL on the browser. Since I have registered my web app in Google Console, and got a pair of Client ID and Secret and a JSON file, so Youtube must allow me to publish videos by default to atleast my channel, isin't it?
I have used the Auth.java file(provided in youtube java code samples) and the following code is where this thing happens.
// Authorize.
return new AuthorizationCodeInstalledApp(flow, localReceiver).authorize("user#.com");
LocalServerReceiver localReceiver = new LocalServerReceiver.Builder().setPort(8080).build();
Please help here as this is really eating up a lot of my development time.
You should only need to authenticate your code once. When your code is authenticated you get a refresh token back. the refresh token will then allow you to get a new access token the next time your code runs.
There is no service account authentication for the YouTube api. Your code has to be authenticated by you the first time in order to get that refresh token.
I am not a java programmer but from a quick check of the documentation it looks quite similar to what I do in.net. You need to create a datastore to to store the first refreshh token then you should be able to run your code in the future with out needing to authenticate it again.
I am in process of migrating from DMCloud to DM Partner Program and was wondering if there was an equivalent for,
get_embed_url()
get_stream_url()
Link to dmcloud documentation
Goal:
To be able to receive embed urls from DM for private videos. It seems DM's player API returns iframe and link is not signed / perishable.
Thanks.
With Dailymotion API, you can query the following fields on the video object:
embed_url which is the url to embed the video. If your video is private, this query returns an url to embed the video with an id beginning by "k", it is the private id of the video. If you share it (embed the video on a public web page), the video is no longer "private" (any user checking the code will be able to access the embed url).
stream_source_url and all others stream_*_url fields. It refers to the URL of this video source. This field has some protections:
only the owner of the video can retrieve it, (s)he has to pass a valid access token otherwise this field returns null
the url can only be consumed by the user who made the api call
the url returned is valid for 2 days
this field is rate limited
I am trying to get all the playlist feed URLs from the YouTube channel in my iOS application.
Below is the URL to get the XML data consists of the required contents.
https://gdata.youtube.com/feeds/api/users/thenewboston/playlists?v=2
This is working fine, which results in the response of an XML with data.
But when I change this to my username nothing is retrieved. I have couple of playlists in my channel.
My Attempts:
Attempt 1:
I have googled and cross checked my channel's privacy settings which is Public in default.
Am I making any wrong? Please let me know your comments.
Attempt 2:
When I try like this in browser, http://www.youtube.com/user/myusername
getting "This channel is not available at the moment. Please try again later.".
The same url is working fine for thenewboston.
Try this
https://gdata.youtube.com/feeds/api/videos?v=2&author=USER_NAME&orderby=published
This will fetch all the user videos.
I have found the solution:
Below is the format that I have tried.
https://gdata.youtube.com/feeds/api/users/userId/playlists?v=2
But it seems there is some change in the API.
To request a feed of another user's playlists, send a GET request to the following URL. This request does not require authentication.In the URL above, you should replace the text userId with the user's YouTube user ID. For backward compatibility purposes, the API also supports having the user's YouTube username specified instead.
To find the userId in YouTube : (Follow the steps below)
Click the arrow on top right after login to your YouTube account.
Select YouTube settings.
Select the link Advanced and find the YouTube User Id there.
Reference : YouTube API v.2.0