YouTube Data API search limit - youtube-api

I'm using YouTube Data API v3 and I tried to find videos published within certain period like below link.
part : snippet
regionCode : KR
relevanceLanguage : KO
publishedAfter: 2020-01-01T00:00:00Z
publishedBefore: 2020-01-02T00:00:00Z
type : video
order : date
https://developers.google.com/youtube/v3/docs/search/list?apix_params=%7B%22part%22%3A%22snippet%22%2C%22maxResults%22%3A50%2C%22order%22%3A%22title%22%2C%22publishedAfter%22%3A%222020-01-01T00%3A00%3A00Z%22%2C%22publishedBefore%22%3A%222020-01-01T02%3A00%3A00Z%22%2C%22regionCode%22%3A%22KR%22%2C%22relevanceLanguage%22%3A%22KO%22%2C%22type%22%3A%22video%22%2C%22videoCategoryId%22%3A%2215%22%7D
But the result seems to be limited to 500. So I tried to see when the 500th video was published.
If I memory the time, I can put that time into publishedAfter and extract another 500.
but oddly enough, the 500th video's published time was almost "2020-01-02T00:00:00Z", the publishedBefore.
first video published time : 2020-01-01T23:53:57.000Z
last 500th video published time : 2020-01-01T00:00:02.000Z
The total result is more than 6000. But within first 500 videos, all publishing time within publishedAfter and publishedBefore appear. So where did the remaining 5500 videos go?

Related

What does the number in codec section of YouTube "stats for nerds" mean

YouTube "stats for nerds" gives the information about the video being played. In the codec section it shows the mimetype and a number in bracket. What does this number mean.
And how to get the latest Itag table for reference.
After a bit of searching I was able to figure it out myself
The number in brackets is the itag number for the codec + container + Profile combination. It is a unique number assigned by YouTube to identify different video types.
As for the latest itag table I was able to get it from Wikipedia.

How to determine the mean duration of YouTube videos for specific search term?

I know YouTube is very closed and doesn't publish any detailed statistics, but I have a specific research interest to find out the length of arbitrary How-To videos.
When I search for that term I will get a few million results. Would it be possible to determine the playback duration for portions of the search results? Since the usage of the YouTube API is limited one could grasp a few videos per day and maybe with multiple API-keys.
Beside using the API there might be powerful scrapers I could use.
JS browser utility
I'd recommend you a simple JS utility to use in a browser dev tools. Read here how to use it for counting. I've modified it to count video length time.
The JavaScript code
So open a youtube search page and open your browser’s Dev tools (it’s F12 on PCs, Preferences -> Advanced -> Show Develop menu on Mac). Once they are open, go to Console (Console tab) and enter the following code:
function domCounter(selector){
var a = document.querySelectorAll(selector);
var hour = 0, min = 0;
for(var i=0; i<a.length;i++){
var time = a[i].innerHTML.split(':');
// console.log(time);
hour += parseInt(time[0]);
min += parseInt(time[1]);
}
return hour + Math.round(min/60);
}
How to find css selector
So to call it in a browser console you just hit:
domCounter('span.video-time')
Disclaimer
This utility works for one search page result though. You might get improve it to traverse pagination.
You won't be able to get the duration videos returned from the search endpoint without looking at the video duration for each one.
The search endpoint does, however, provide videoDuration parameter you can pass in to your request to only return videos of a specific duration range:
The videoDuration parameter filters video search results based on
their duration. If you specify a value for this parameter, you must
also set the type parameter's value to video.
Acceptable values are:
any – Do not filter video search results based on their duration. This is the default value.
long – Only include videos longer than 20 minutes. medium – Only include videos that are between four and 20 minutes long (inclusive).
short – Only include videos that are less than four minutes long.

Rate Limit Twitter API

I'm kind of confusion with twitter api guide on rate limiting mention over here https://dev.twitter.com/docs/rate-limiting/1.1
In their guide twitter has mention the follow field would be present in the response headers which can be use to a determine the amount of api call allowed , left and will rest at info
X-Rate-Limit-Limit: the rate limit ceiling for that given request
X-Rate-Limit-Remaining: the number of requests left for the 15 minute window
X-Rate-Limit-Reset: the remaining window before the rate limit resets in UTC epoch seconds
Now they have also given a rate limit status api to query against
https://dev.twitter.com/docs/api/1.1/get/application/rate_limit_status
Now I'm kind of confuse which of the above value should I follow to see how much api call is available for me before the desired limit is reach .
Both seem to return the same. While /get/application/rate_limit_status is an API call which returns rate limits for all resources, X-rate-limits sets the header for the resource you just called.
Use /get/application/rate_limit_status to cache the no of API calls remaining, refresh at periodic intervals rather than having to make a call and then parse the header info to check if you've exceeded rate limits

Divide YouTube Video into different hyperlinks?

I have a YouTube Video (which was NOT uploaded by myself) with 50 min length:
The video talks about different contents, each content starts at different time for example:
content_x starts # 0minutes : 0Seconds
content_y starts #10minutes : 0Seconds
..etc
Now I would like to divide these contents according as hyperlink such that if i would like to watch any section, I can just click this link in the respective time (minutes & seconds).
I would prefer to do that in the description part for the YouTube video or in "About Section" so can you guide me how to do that? or any other simpler idea on how to reach different video contents in YouTube in dynamic and descriptive way?
You can append the time you want to the end of the youtube link
Eg
http://www.youtube.com/watch?v=XXX#t=31m08s
where 31m08s represents 31 minutes 8 seconds.
Similarly you can make links for the rest of the sections you want
Check this site : www.youtubetime.com it will generate a Youtube link with a specific starting time. Alternatively, tou can just write your time separated by spaces in a video's description (e.g.
very long description 0:00 part 1 1:00 part 2
etc... or you can write a comment with these time links and use it as an "index".
Hope that I've answered your question.
Right click the video and select Copy video URL at current time.
Then paste it anywhere.

National Weather Service (NOAA) REST API returns nil for parameters of forecast

I am using the NWS REST API as my weather service for an app I am making. I was initially reluctant to use NWS because of its bad documentation, but I couldn't resist as it is offered completely free.
Now that I am trying to use it, I am running into some difficulty. When making a request for multiple days, the minimum temperature appears nil for several days.
(EDIT: As I have been testing the API more I have found that it is not always the minimum temperatures that are nil. It can be a max temp or a precipitation, it seems completely random. If you would like to make test calls using their web interface, you can do so here: http://graphical.weather.gov/xml/sample_products/browser_interface/ndfdBrowserByDay.htm
and here: http://graphical.weather.gov/xml/sample_products/browser_interface/ndfdXML.htm)
Here is an example of a request the minimum temperatures are empty: http://graphical.weather.gov/xml/sample_products/browser_interface/ndfdBrowserClientByDay.php?listLatLon=40.863235,-73.714780&format=24%20hourly&numDays=7
Surprisingly, on their website, the minimum temperatures are available:
http://forecast.weather.gov/MapClick.php?textField1=40.83&textField2=-73.70
You'll see under the Minimum temperatures that it is filled with about 5 (sometimes less, it is inconsistent) blank fields that say <value xsi:nil="true"/>
If anybody can help me it would be greatly appreciated, using the NWS API can be a little overwhelming at times.
Thanks,
The nil values, from what I can understand of the documentation, here and here, simply indicate that the data is unavailable.
Without making assumptions about NOAA's data architecture, it's conceivable that the information available via the API may differ from what their website displays.
Missing values are represented by an empty element and xsi:nil=”true” (R2.2.1).
Nil values being returned seems to involve the time period. Notice the difference between the time-layout keys (see section 5.3.2) in 1 in these requests:
k-p24h-n7-1
k-p24h-n6-1
The data times are different.
<layout-key> element
The key is derived using the following convention:
“k” stands for key.
“p24h” implies a data period length of 24 hours.
“n7” means that the number of data times is 7.
“1” is a sequential number used to keep the layout keys unique.
Here, startDate is the factor. Leaving it off includes more time and might account for some requested data not yet being available.
Per documentation:
The beginning day for which you want NDFD data. If the string is empty, the start date is assumed to be the earliest available day in the database. This input is only needed if one wants to shorten the time window data is to be retrieved for (less than entire 7 days worth), e.g. if user wants data for days 2-5.
I'm not experiencing the randomness you mention. The folks on NOAA's Yahoo! Groups forum might be able to tell you more.

Resources