youtube statistics API broken - api

First of all, sorry for my badly articulated question, this is my first ever question to post here.
I have programmed a youtube search engine for myself and used it for a long time. Yesterday i noticed it was not working correctly anymore.
I spent some time looking for the problem and soon enough noticed that some of the video statistic data queries return nothing.
Here is an example API URL that doesn't work:
https://www.googleapis.com/youtube/v3/videos?id=nNmfb2FQ8MA&key=PUT API KEY HERE&fields=items(statistics)&part=statistics
If you replace the video ID it should return the statistics of the video.
It just doesnt show anything for some youtube IDs for some reason

Related

How can I get the Views Per Hour stat for a YouTube video?

I checked the Youtube API and it's mainly to do with adding functionalities related to the YouTube app rather than getting analytics data about videos.
There is a chrome extension called VidIQ that shows the views per hours of a particular video when going to the video's page on YouTube, so I tried reading the source code for it, but it is all compressed and I can't easily find what I'm looking for.
Could someone explain to me how VidIQ chrome extension is getting the views per hour stat for YouTube? Maybe it's not an official stat from Youtube but a rough estimate calculated by VidIQ. How do they get this information?
I tried debugging the VidIQ chrome extension to search through the source code but adding a simple html tag made the file corrupted and disabled the extension until I repaired it again. I'm having difficulties deciphering the source code.
Most of what VidIQ gets is from the YouTube analytics api and not directly from the YouTube data api although i would be they use some combination of both.
If you create a report that extracts views and run it every hour you should get the results you are looking for.
However i would be willing to be that they cache a lot of the data and do some internal analytics on it. They would need to cache it as the YouTube analytics api only returns data for the last 90 days last i checked.
If your intent is to Reverse Engineer VidIQ you may need to accept that a lot of the data you are seeing is internally stored in their system and generated by them based upon the data that is avaliable in the YouTube Analytics API and the YouTube data apis.

YouTube search API for videos in a specific channel often gives no results

I'm using the YouTube search.list API to look for all videos on a specific channel:
https://www.googleapis.com/youtube/v3/search?part=snippet&type=video&channelId=my-channel-id&key=my-public-key
(I can't give specifics due to privacy I'm afraid.)
So this works well for common YouTube channels, but only sometimes works for certain personal ones, often returning no results.
What happens with personal ones is: the first call you make returns the videos, but if you refresh the browser it returns with no results (but no errors either).
I found these two live issues regarding inconsistent search results, but my problem seems a bit different (no query, just a specific channel ID).
Any idea what's going on? I can't find differences between the channels that return results consistently and those that don't. It's almost as if Google is throttling certain search results. The same thing happens if I'm authorised rather than using a public key.
An alternative approach to getting all of the videos in a channel (ideally in a single call) would also be acceptable.
So to answer my own question, you can use the activities.list API to get all videos in a channel, which seems more reliable than search:
https://www.googleapis.com/youtube/v3/activities?part=snippet%2CcontentDetails&channelId=my-channel-id&key=my-public-key
You need to include the 'contentDetails' part as it contains the video ID.
Update
Another way is to use the "uploads" playlist (see this SO answer). This is better than activities, as activities include things other than video uploads, and the API doesn't provide a way to filter.
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=my-uploads-playlist-id&key=my-public-key

How to search for videos using GettyImages Connect API

I'm trying to use this API to search for videos. I have a client key, secret, and everything I need.
I have scoured the API doc page up and down several times, and can't find any reference to video search.
The on-site search allows video search, and the API works fine when I search videos.
I use:
'https://connect.gettyimages.com/v3/search/images/editorial?phrase=' + query + '&fields=id%2Ctitle%2Ccaption%2Cpreview to search for images, and I've tried every combination of the word 'video' in that to search for videos, to no avail.
The images search works great, by the way.
The "swagger" interactive page (most annoying way to display an API doc, by the way) has a section for images, search/images, etc, but no video search or video (using video id).
the v3 API release notes states that they now have support for video search and download. Where?
Thanks to anyone that can lend a hand here, this is probably the most confusing API I've ever encountered.
Thank you!
sorry it's taken so long answer your question! At the time you posted, I don't think we had our video-specific search and download endpoints up. They are there now, though they're still in beta. Should be that way for a couple more weeks.
https://connect.gettyimages.com/swagger/ui/index.html#!/Search
Searching for "video" via the image search endpoints will not give you video files.
Thanks,
Matt
Getty Images API operations

How to get youtube video title - vb

I am currently creating a youtube downloader and I have the code to retrieve video thumbnails, however I want to find out a way to retrieve the video title and possibly the video size etc. If anyone can help please answer :D
I would concider you use version 3 of the Youtube API. I don't suggest parsing the html of a youtube page, you never know when they will change the format and you'll be downloading too much information. The API is much more stable.
If you look at the video section .
https://www.googleapis.com/youtube/v3/videos?id=BaW_jenozKc&part=snippet
(I can't test it on this computer)
By changing the part (or adding multiple part) you can get all the information you need about a video. Since the result is returned in json, you can use it with pretty much any programming language.
Also, read the Gettting Started. Youtube limits the number of query unless you register your application and get a developper key.
You need to read the .NET YouTube API documentation, specifically the YouTube API v2.0 – Retrieving Data for a Single Video section.
You will need to query for a single video by the video's ID and then the pieces of data in the ATOM feed that comes back to you are:
feed/entry/Title for the title of the video
feed/entry/media:group/yt:duration for the length of the video
There does not appear to be a value returned for the size of the video, however.
Try the youtube API:-
https://www.youtube.com/get_video_info?video_id=BaW_jenozKc
It should return something along the lines of:-
"&title=youtube-dl+test+video+%22%27%2F%5C%C3%A4%E2%86%AD%F0%9D%95%90".
Credits to youtube-dl:-
https://github.com/rg3/youtube-dl/blob/master/youtube_dl/extractor/youtube.py

youtube feed api orderby parameter not showing up all results

I am implementing youtube api for searching videos. I have noticed that search results differ by changing orderby parameter's value. There is one video which shows up with "published" but not with "viewCount". I know, list order will change by changing parameters.
While using viewCount for orderby parameter, videos with lesser view count are visible but some specific video is not listed having large viewCount. And same video can be found by using "published" for orderby.
Kindly explain, how exactly youtube api works.
Thanks!
On an ongoing basis, statistics for a video are typically updated every 30 minutes to two hours. However, updates may occur less frequently under heavy server loads or for videos that are viewed very infrequently. In search feeds, updates to ratings and view counts could take as long as a couple of weeks for infrequently viewed videos.
The YouTube Data API retrieves search results from a specially optimized search index. The index is designed to include new videos as quickly as possible while ensuring high performance even under heavy API server loads. For more info see here: YouTube API