Recently I am trying to collect Youtube channel infos by urls. With Youtube API V3 youtube.channels.list, I can get channels by below two types of urls with no problem.
https://www.youtube.com/user/LadyGagaVEVO/ (query by forUserName)
https://www.youtube.com/channel/UC07Kxew-cMIaykMOkzqHtBQ (query by id)
However for the custom url such as
https://www.youtube.com/phunky
I found no official way to get the channel. I know it is possible to get the channel by parsing OpenGraph meta-data. Still want to know if there is more ideal way with the V3 API.
Thanks
The only solution I've seen is from this answer which is to use the search api. It's not perfect but it is the only solution I've seen.
Related
I'm trying to retrieve the comments I've made on YouTube to turn them into Markdown files, but I can't find a way to do it filtering by user in the API documentation.
I thought it would be possible since the Google account has a link for it but when using the parameter "channelID" in the API to list comments as it says in the documentation, it gives back a 400 error.
You are looking for the comments your channel posted, however when using CommentThreads: list with channelId=YOUR_CHANNEL_ID you are listing comments people wrote on your channel, as described the documentation:
channelId
string
The channelId parameter instructs the API to return comment threads containing comments about the specified channel. (The response will not include comments left on videos that the channel uploaded.)
One more time YouTube Data API v3 AFAIK doesn't provide this basic feature.
You have two possibilities:
Use Google TakeOut (make sure to export Comments in YouTube and YouTube Music)
Web-scrap the webpage you provided
I am trying to retrieve list of my own comments from my channel via YouTube API but can not find a way to do it. This is available via the history (https://www.youtube.com/feed/history/comment_history), but there is no mention in API documentation (https://developers.google.com/youtube/v3/docs).
Going through liked/disliked videos, then retrieving all video comments and searching for myself seems way too complicated, slow and will use too much quota.
Is there a better way to get own comments via the API?
First off, apologize to post this, I don't think it is a duplicate since I kept crawling YouTube API tagged questions since yesterday and I couldn't find a fix.
My Question is, Can I keep using V2 of YouTube API even if it is officially deprecated ? the reason why is because I have 2 issues I still couldn't find a fix for them in V3 and I already have them in V2 : listing a channel's last uploads and popular uploads.
For the last uploads, in V2 I use http://gdata.youtube.com/feeds/api/users/youtube/uploads?prettyprint=true , while I add ?orderby=viewCount to list the popular ones. I couldn't find an alt in V3 [ Tough I tried https://www.googleapis.com/youtube/v3/videos?part=snippet&chart=mostPopular&forUsername={Username}&maxResults=5&key={key} but it keeps listing videos from a channel I visited yesterday even if I change the username, making me think there is problem with the link or my key, a server key by the way ]
Any ideas ?
Thanks a lot !
Rather than using the videos->list endpoint, you should instead use the search endpoint, like this:
https://www.googleapis.com/youtube/v3/search?order=viewCount&part=snippet&channelId=UCuo5NTU3pmtPejmlzjCgwdw&maxResults=25&key={YOUR_API_KEY}
You can do order=date to have them ordered chronologically rather than by popularity if you'd rather. There are also a lot of other parameters you can use ... see https://developers.google.com/youtube/v3/docs/search/list for more details.
If you don't know the channel IDs, but only the usernames, you'll have to have multiple calls ... a call to this endpoint:
https://www.googleapis.com/youtube/v3/channels?part=snippet&forUsername={username}&key={YOUR_API_KEY}
This will return a packet with the channel ID in it. If you'd like to avoid making multiple calls or storing the username/channelID on your own, you could do the video search with the 'q' parameter set to be the username. It often works but you can get extraneous channels that way.
I use some standard feeds of YouTube API v2 like:
http://gdata.youtube.com/feeds/api/standardfeeds/recently_featured
http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed_Music?time=today&v=2
Now, I want to switch to API v3, I have read the doc here: https://developers.google.com/youtube/v3/docs/
There are many resources types and methods, but it seems none is correspond to the old v2 standard feeds, is there any solution for the job ?
You can use videoCategories and guideCategories for that.
Here's the full blog.
GDL video.
YouTube API v2 allows you to a) search for safeSearch only and b) get the media rating (eg PG-13) https://developers.google.com/youtube/2.0/reference#youtube_data_api_tag_media:rating .
Is there a way to do this in the v3 API?
If not: Why was this omitted? Are there plans to remove it from v2?
In general, what's the best way using the API to tell if a video is safe?
You should be able to use the safeSearch parameter as described at the following link:
https://developers.google.com/youtube/v3/docs/search/list
I hope that answers the first half of your question.
Furthermore, you can find the getRating method at
https://developers.google.com/youtube/v3/docs/videos/getRating
under the list of video methods (this section also lists the various ratings such as pg13 etc):
https://developers.google.com/youtube/v3/docs/videos