Youtube API V3 how can i get channel username - youtube

I need to use youtube username in a javascript script that retrieves data from youtube API with username
the problem is that this channel has a custom url in format:
https://www.youtube.com/c/myname
but from tutorial and video i found i need to get the user from a custom url like this
https://www.youtube.com/user/myname
since, as far as i know, is not possible to set an url and surname based on second url for newer channel how can i found the username?
any way to get it with API?

youtube.channels.list does NOT provide the username. you have to use Google+ API to get it.

tube_dl is the answer.
pip install tube_dl
This module is a great video downloader and youtube parser.
Here's the sample code:
from tube_dl import Youtube
yt = Youtube('your video id').channelUrl
For tube_dl documentation, visit Github Page of tube_dl

You can try out the Channels.list method on the YouTube Data API. You can pass the username and it will return the list of channels that said user have.
The YouTube Data API developer site has more information if you want to learn more about it.

Related

How to crawl YouTube Video comments?

since YouTube Data API v2 no longer exists, you need extra permission from the user to read video comments (like permission youtube.force-ssl). There isn't any possibility to read video comments with the permission "youtube.readonly".
With Data API v2 ist was possible to read youtube video comments like this:
https://gdata.youtube.com/feeds/api/videos/VIDEO_ID/comments
But how is it possible to get the youtube comments only with "youtube.readonly" permission? YouTube loads comments dynamically with ajax, so is it possible to crawl these comments?
Thanks a lot!
If you want to read top level comment by url, like you have said in your question
You can get it, but you need a youtube api key,(its free)
https://www.googleapis.com/youtube/v3/commentThreads?part=snippet&videoId=NK94g7Qctuw&key={YOUR_API_KEY}
You do not have to get any access token, again if you want it to get from access token try to get refresh token like
$client->setAccessType('offline');
$client->setApprovalPrompt('force');
Add above two line code in youtube api sample, you will get a auto refresh token. Hope it helps you.

How to get Youtube page's username Using Youtube API

I am trying to find the page's username through the Youtube API (******#pages.plusgoogle.com). I'm not getting this information through a request like: GET https://www.googleapis.com/youtube/v3/channels?part=snippet&mine=true
What should I do?
PS: I'm using the PHP Library.
Its not possible to get the /c/username or the /user/username via the YouTube API at this moment.

Version 3.0 alternative for YouTube 2.0 API playlist

We did have this playlist. It is great because using this info we can show a latest video on YouTube.
https://gdata.youtube.com/feeds/base/users/africawoodgrow/uploads?alt=rss&v=2&orderby=published
How do we receive the same information from the new 3.0 API?
The first thing you'll need to do is register for an API key -- you can do this by creating a project at console.developers.google.com, setting the YouTube data API to "on," and creating a public access key.
Once you have your API key, you'll need to get the channel ID you're interested in (rather than the username). If you don't know the channel ID, you can get it this way:
https://www.googleapis.com/youtube/v3/channels?part=snippet&forUsername={username}&key={YOUR_API_KEY}
Once you have the channel ID, you can get those videos with the search endpoint, like this:
https://www.googleapis.com/youtube/v3/search?order=date&part=snippet&channelId={channel id here}&maxResults=25&key={YOUR_API_KEY}
There are also a lot of other parameters you can use to retrieve videos; see https://developers.google.com/youtube/v3/docs/search/list for more details.

Getting a Youtube channel's video list as an rss feed

How can I form requests using the youtube api to get the videos from a channel as an rss feed?
I read this question, where a link to the new api (V3) is given, but I couldn't find it there. I tried with the deprecated syntax from api v2:
https://gdata.youtube.com/feeds/users/UCqAEtEr0A0Eo2IVcuWBfB9g/uploads
but it only works sometimes.
I also tried:
https://www.googleapis.com/youtube/v3/search?key={your_key_here}&channelId={channel_id_here}&part=snippet,id&order=date&maxResults=20
where I enter the channel id and the search key, but I get a 'bad request' error.
To answer the question in the headline:
Pre-append https://www.youtube.com/feeds/videos.xml?channel_id= to the channel unique identifier.
For example, lets assume that the channel url is https://www.youtube.com/channel/feed/UCpjNXONNE-JUz74ACsRCgcw. So the rss feed URL would be https://www.youtube.com/feeds/videos.xml?channel_id=UCpjNXONNE-JUz74ACsRCgcw.

How to get the gdata address for a youtube channel?

Hey Developer's I am working on an android app. I see this gdata.youtube kind of address in tutorials. I need to get one for my channel. Please how do i go about it.
Thanks.
The gdata links are from YouTube Data API v2.0 which is deprecated. You should look into Youtube Data API v3.0.
Here is how to get started: https://developers.google.com/youtube/v3/
If you just want to get information about your channel use this link:
https://content.googleapis.com/youtube/v3/channels?part=snippet&mine=true&key=YOURAPIKEY
Replace YOURAPIKEY with the public access API key from https://console.developers.google.com/project

Resources