Retrieving artist and song information from youtube - youtube

A long time ago, I developed a chrome extension that is able to scrobble the songs you listen to on youtube (via your last.fm account). What I did was simply taking the title of the video and assuming it had the proper format: "Artist - Track name" (obviously, I would send a request to last.fm, confirming it was a proper artist/song pair, before scrobbling). Recently (well, probably a couple of months ago) youtube started to provide artist and song information directly under the video (see image), and I was wondering how best to extract this information.
I was hoping to retrieve the information via the youtube feed api call (http://gdata.youtube.com/feeds/api/videos/videoID?alt=json), but it doesn't apear to be featured in the returned json element. Alternatly, I could try extracting it via xpath, but I figure that might lead to complications when no artist/song information is present. If anybody could help me extract this information, and thereby greatly improving my extension, I would be very grateful.

I don't think YouTube API can provide you with the artist name
as the videos can be other things that songs
you need to stick with what you have , unless they updated there API

Related

YouTube API: Check if Someone Else's Video is Monetized or Not

There is a website called: TubeSift
This tool determines whether a video is "monetized" or not.
My simple question is...
Is there a way to determine if a specific YouTube video is monetized (can show in-stream ads) via some YouTube API?
If yes, which YouTube API?
If no, how then might TubeSift be determining this? Scraping the response?
Important distinction: this would be a video that you DON'T have authentication or credentials to manage - ie: it's someone else's video.
Similar questions asking slightly different things
youtube api to get channel monetization status?
Disclaimer
I realize this question seems off-topic because it doesn't have a code example but YouTube's How to Get Help says to basically ask questions here on StackOverflow for help.
We support the YouTube Data API on Stack Overflow. Google engineers
monitor and answer questions with the youtube-api, youtube-data-api,
and youtube-v3-api tags.
There's really nowhere else to ask.
Youtube provides API to YouTube content partners. I also checked the tubetarget and used scraping also but scraping is very slow as compared to the tubetarget
See this page to get enrolled.
According to youtube: When using delegation in the YouTube Data API, the onBehalfOfContentOwner parameter is always required. The parameter's value is an ID that uniquely identifies the content owner. You can retrieve the ID programmatically by calling the YouTube Content ID API's contentOwners.list method.
Detailed description here
YouTube Partner Program overview, application checklist, & FAQs
Also, check this
YouTube Partner Program policies
Please let me know if you are able to get Content Id API
In my opinion, i think if the video is greater than 10 minutes, therefore that video is being monetized, i read somewhere before that a video needs to have at least 10 minutes in order to be monetized, and obviously we can get the video duration via the API.
The json key is:
+"contentDetails": {#213 ▼
+"duration": "PT4M21S"
The time is formatted as an ISO 8601 string. PT stands for Time Duration, 4M is 4 minutes, and 13S is 13 seconds.
But the way Tubesift does it is just an intelligent guess or maybe some randomizing the "monetized" tagged of a video.
Hope that helps.

Get Cards for Videos from Youtube APIs

I'm trying to get a list of all cards associated with a video id. I've looked at the different Youtube APIs, but no success.
example of cards in a video
Does anyone have an idea how to do this?
Thanks
This is currently not supported by Youtube API. You can find the supported methods by Youtube API in this reference list.
Disclaimer - this is only a partial answer.
It is possible to get card stats for a given channel through the Reporting API.
To do so, you need to create a reporting job https://developers.google.com/youtube/reporting/v1/reports/channel_reports#video-cards
This will give you basic stats (card_id included) for every card of every video for one channel during the specified time interval. At this stage, we know that there are cards for a given video, we know what type of cards these are, and we have some basic stats regarding their performance. We still don't know what is behind that card.
So the follow up question is: how to query youtube APIs with a card_id to retrieve more detail information about that card?
If someone knows this, then we have a way of getting card infos for any video.

YouTube API derived data

I'm working on a application which would gather YouTube user's video data and create some meaningful data and metrics to help the creators market their videos better and expand their audience.
The problem is that since December 18, if I'm not wrong, this kind of practice is forbidden.
Can someone from Google comment and explain this change? Why can't I create metrics based on YouTube data, even if I visibly communicate that this is not data from YouTube?
For example: I would like to fetch users video description and tell what's the keyword density, how well is it prepared for SEO (in % or something).
And I guess that this new term destroys many businesses which are doing exactly that thing, creating meaningful data based on YouTube API. (Tubular, TubeBuddy, VidIQ).
Please! Anyone?

YouTube API "mostPopular" requests doesn't seem to give updated results

It seems that the YouTube API doesn't give updated results for mostPopular videos in my country since few days.
Example:
This request (https://www.googleapis.com/youtube/v3/videos?part=snippet,contentDetails&chart=mostpopular&regionCode=FR) doesn't give me the same videos results than the ones displayed directly on YouTube for the French most popular channel (https://www.youtube.com/channel/UCmzy72gDEpfXoFV9Xdtd0DQ). It seems that the results of this request is not updated since the 1th of february. Results was real time updated before this.
Does someone know if something is wrong with my API request, or if there are some issues with the YouTube API at this moment?
There is nothing wrong with your request. This is a known issue with the YouTube API reported here for Saudi Arabia (but also applicable to multiple regions), and another related issue here with regard to content from France.
Your best bet would be to follow up with the YouTube team on one of those defects, or potentially (and dangerously) scrape the YouTube site for the correct results.
Problem seems to be solved since 13th of february (maybe someone from Google have seen my post..)
YouTube Channels and chart=mostPopular parameter data are separate data entities, aka you will get different results. They may be related but there is no guarantee you will get the same data. To get the data that you want you may need to query for channel itself and its videos.
I got this information from the thread #Jal linked, there was an update by matthewc...#google.com a few days ago:
The most popular channel for Saudia
Arabia and
the mostPopular chart parameter in the video.list
call
are separate and distinct entities. If you'd like to get the content
of the most popular channel for Saudia
Arabia
please use the Data API video.list call to list the videos with the
channel ID (in this case "UCWY-_j1MCth6yf24m58Bh_Q") by setting the
items/snippet/channelId parameter.
My current concern right now is that there is supposedly a way to get video information from the videos.list endpoint using a channelId, which does not seem the case in the API Explorer. I will update my answer once I figure out what this person meant exactly.

Youtube API 2.0 Checking if a video is age restricted

I would like to check and see if a youtube video is age restricted. There are not many videos that are, but some are. I have been digging around in the youtube api documents and on the internet, but can't seem to find a way to detect this.
I am using the Youtube API V2 and only looking for one video at a time.
To check whether a video is (age) restricted in a given region, you can take a look at the media:rating attribute of the video entry, which is documented at
https://developers.google.com/youtube/2.0/reference#youtube_data_api_tag_media:rating
If you want to do a search and filter out videos that are age restricted, you can use the safeSearch=strict parameter:
https://developers.google.com/youtube/2.0/reference#safeSearchsp
I agree to Greg Schechter. The actual question was like if we have a video id (eg: In the link http://www.youtube.com/watch?v=RyDY0hiMZy8 the video id is RyDY0hiMZy8), how can we get the age restriction details based on that?
There is an API provided by Youtube to get the details based on the video id. For the above example the API link is:
http://gdata.youtube.com/feeds/api/videos/RyDY0hiMZy8?v=2&alt=json
But there is no information about the age restriction in the response.
Update on the above post:
In the API response from http://gdata.youtube.com/feeds/api/videos/tA4wytG3uh0?v=2&alt=json
we have a media$rating content coming and the data coming there can be compared with the rules mentioned in the link https://developers.google.com/youtube/2.0/reference#youtube_data_api_tag_media:rating
For non restricted videos, the media$rating value is not coming in the response. eg: in the link http://gdata.youtube.com/feeds/api/videos/RyDY0hiMZy8?v=2&alt=json
Any updates are welcome.
Age gating is not supported for embedded playbacks; so it's not something that is returned in the YouTube data api.
You can un-restrict those videos by following this link:
https://www.quora.com/How-do-you-change-the-settings-of-the-the-age-restrictrincts-on-my-YouTube-videos/answer/Doyle-Lorraine
Then your iframes should be back to normal.

Resources