How can I get youtube channel id by auto-generated channel #name? - youtube-api

I'm trying to retrieve a youtube auto-generated channel's video by youtube channel name like #ComputerScience. I searched around and couldn't figure out a way of how to do it, once the channel doesn't have an user. Any suggestion of how do it?
My code works fine for user generated content but for auto-generated doesn't.

This way looks fine
GET https://www.googleapis.com/youtube/v3/search?part=snippet&maxResults=1&q=%23computerscience&key={YOUR_API_KEY}

Related

Youtube API 3 get latest videos from a channel

I am trying to use youtube api to fetch the latest video uploaded in a channel and the query is as below
https://www.googleapis.com/youtube/v3/search?key={KEY}&channelId={CHANNEL-ID}&part=snippet&maxResults=1&order=date&type=video
But it is not returning the latest video uploaded in that channel. Adding or removing order attribute doesn't seem to work as it keeps returning the same video.
You have do to this by fetching playlist items. Get your channel id. It should look like this: UC######################. Now you have to replace the 'C' to 'U'. Like this: UU######################. You can call the youtube api with this id now.
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=UU######################&maxResults=5&key=[YOUR_API_KEY]

How to retrieve YouTube video id of videos from a channel (YouTube)

I am working in an android app which shows videos from a YouTube Channel.
I have the channel id and all other stuffs. But I need the video id to show the video in YouTube Player.
***eg. player.cueVideo("nCgQDjiotG0");***
When I go through the developer site again and again, I got this one -https://www.googleapis.com/youtube/v3/videos?part=id&chart=mostPopular&key={YOUR_API_KEY}
It is working perfectly returning the correct Video id to play. But I can't done it with my Channel id (There is no option for passing channel ID as parameter).
The only one url which accept the channel ID and returns snippet is this one -
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCxUtHtpGzd0bA5rYRY7h4VQ&q=PIVideoLibrary&type=channel&key={YOUR_API_KEY}
But the id it returning is not compatible with the above method. When I run it in the device it shows "Invalid Request" Here is screen shot which is the response of the above search request.
So this is my question.
How can we get video id of a video from a YouTube channel to show that
vedio in a youtube player integrated in the android app using YouTube
api v3
Thank You.
Ya I found it.
Go to youtube developer, https://developers.google.com/youtube/v3/docs/activities/list .
You can find a "TRY IT" field at middle of the page, fill the fields, you have to enter "contentDetails in the 'part' field to obtain video id. Then enter your channel id in the respective field. Execute the query, you can find the video id in the XML result.

YouTube API v3: Liking a video with no channel set up

I have code that will "like" a video through the YouTube API v3. At first, my code was throwing a 403 Forbidden error, and I tracked this down to the fact that my youtube account did not have a channel associated with it. I created a channel by going to youtube.com, and clicking the "add to" link underneath a video. A popup came up that said "Set up your channel to create your playlist on YouTube". As soon as I filled out that form, and clicked continue, the code stopped returning a 403, and started working.
Is there anyway to "like" a video without having to go through this channel setup process? Or if not, is there any way to tell if a user does not have a channel on their account, and prompt them to set it up if needed?
For reference, my code is written in python and is based off of the example here:
https://developers.google.com/youtube/v3/docs/playlistItems/insert
Thanks,
Josh
Edit: There's now a channel.status.isLinked property which will reliably tell you whether a channel resource is "linked" in v3.
That being said, it is possible to like a video using the YouTube.com web interface for an account that doesn't have a channel, and I also believe that it was possible using v2.1 of the legacy GData API. The fact that you can't do that in v3 sounds like a bug to me, and I'll escalate that internally.

retrieving video information and link to mp4

Is there any documentation about the http://www.youtube.com/get_video_info?video_id=XXX ?
Since a week or so it seems I do not get correct information anymore. I am using the url_encoded_fmt_stream_map property in the response stream to get the url for the video link of the mp4 type of my video. But this property is now returning an empty value.
Has something been changed in the get_video_info functionality?
The get_video_info endpoint is not, and has never been, a supported public API.
If you'd like to play back YouTube content, you need to use one of the official YouTube Players:
https://developers.google.com/youtube/getting_started#player_apis

include existing youtube video in my own youtube account

Is it possible to add to my youtube account a video I liked in youtube without having to upload it?
This is for an application i´m developing... I´m looking for something similar to share on twitter feature.
But any help is welcome!
Thanks
You can add it as a favourite, as Yuliy has said, or you can create yourself a channel, add a playlist to that channel, then add the video in a similar way to the playlist.
Doing it this way means you can 'see' it from the API(getplaylists, getplaylist)... But, if the original author decides to take the video down, then of course it will disappear from your channel page as well (or more likely say 'this video has been removed by the user').
You cant keep a 'copy' of the video like this.

Resources