My question is if there's a way to get the monthly original views. From a YouTube channel with Google Authentication system and YouTube APIs. Because i'm writing a little script that say's like when a curtain person get over a amount of, monthly views they will get sended further in to the site and get a document send through. Else they go back to the homepage, Is it possible to do this so yes how because i can't seem to find a way
You can use the YouTube Analytics API to run a report against a given video to request the number of "uniques" aggregated by month, for an arbitrary date range. The report definition would look something like
ids=channel==UC...
dimensions=month
metrics=uniques
filters=video==VIDEO_ID
start-date=2013-01-01
end-date=2013-01-01
You'd have to run that report once against every video in the channel, though, and add up the totals.
Note that the end-date is NOT the last day of the month you're looking for, it's the first day of that month again (i.e. it's a "month identifier", not a range of days).
You should note that you need to have an OAuth 2 token for the owner of the channel with the appropriate YouTube Analytics (and Data API, to get the list of videos) scopes in order to run that report; you can't just run an arbitrary Analytics report for an arbitrary video without being authorized.
Related
I am looking for a way to get top-50 most popular videos from Explore Tab for a specific date or a period of time for a specific country. Can't find a way how to do it in YouTube API Documentation. Is there a way? If not, maybe you know some workarounds for getting a historical data?
For example, I could build a web scraper that would collect trending videos from Wayback Machine but it shows trending videos in the U.S. only.
Also, found YouTube Charts website, but it shows only music.
As far as I know, there is no such public endpoint or public resource to get these results - besides Wayback Machine and the public/official YouTube channels you can find on their website.
However, since you mentioned using Wayback Machine, you could follow these steps:
Enter to Wayback Machine and search for results about the Pouplar on YouTube channel - see example of extract from Jun 15, 20211.
Retrieve the videos shown in the search results from step 1.
That being said, I recommend you to start creating a database for record trending videos everyday - not sure how you can do this by region, though (this is due there are trending videos by "main countries" like UK, India, some parts of Asia, France, but, as I searched, trending applies for ALL countries) - if I'm wrong in this, please, let me know.
Another possible way to get close results to your expectations could be:
Enter to Popular on YouTube channel and check the Popular now playlist.2
Retrieve those results and organize the results - with this, I mean: check the publication date, check the channel's country/location, etc. It's up to you to check how to organize the available data.
1 Please check that probably there is no data/snapshot on a given day you require - using Wayback Machine -.
2 According to the updated date, this playlist is updated everyday, so, you have to make the same procedure mentioned above (create a database that store results everyday, etc.).
Not sure if with an VPN you can set the VPN and try to get the "Popular now" videos from the selected VPN country, might worth give it a try.
Try also contact with YouTube - probably you might get some sort of answer, ask them if they can provide information about trending videos from a specific region - in a specific time.
So I'm using Home Assistant to launch an automation that retrieves the newest videoId that a channel has uploaded, so I can use my google home to play it(on a Roku TV), works fine, I am working on creating an automation that also does a GET request but for now, I am using the home assistant rest sensor that updates by performing a GET after a set number of seconds, for some reason though there are only 3 sensors polled every minute or so it seems they use around 100-500 quota(hitting my quota of 10,000 after only a few hours or less), I'm not sure if this is a home assistant problem or if I am not using the api correctly(I only need the videoId), ill link my url below:
https://www.googleapis.com/youtube/v3/search?key=API_KEY&part=id&order=date&maxResults=1
Expected 1-3 quota usage per GET, getting 100+ quota usage per GET.
Querying the Search Endpoint is more expensive than querying the PlaylistItems endpoint for the given user's uploads playlist. Depending on usage patterns, the default quotas may put rather tight limits on the number of calls an user is allowed to make on various endpoints of the API.
Adapting my answer to a different question, I suggest you to do the following instead: call PlaylistItems endpoint, passing to it as playlistId parameter the given channel's uploads playlist ID.
A given channel's uploads playlist ID is obtained upon querying the channel's own endpoint. The needed ID is to be found at .items.contentDetails.relatedPlaylists.uploads. Usually, an channel ID and its corresponding uploads playlist ID are related by s/^UC([0-9a-zA-Z_-]{22})$/UU\1/.
Note that you should query the Channels endpoint only once, then use the returned uploads playlist ID as many times as you need.
Also note that you may experiment using the fields parameter applied to your queries, as to get from the API partial resources only. However, I'm predicting that (I may well be wrong, since did not tested it) the cost of 3 points for querying PlaylistItems for its contentDetails object cannot be improved.
Here is a prototype URL:
https://www.googleapis.com/youtube/v3/playlistItems?key=APP_KEY&part=contentDetails&fields=items/contentDetails/videoId&maxResults=1&playlistId=PLAYLIST_ID
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®ionCode=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.
TunnelBear offers 1 GB free every month when you tweet about them. I am trying to implement something like this in my web app.
This is how I intend to go about it.
My system will let anyone tweet about my business with some predefined message like "Use Awesome_business to increase profit. Awesome_business is the best!"
A cron job will regularly (every 5 min) fetch the last 10 tweets of all connected twitter accounts
Analyse them to see if they contains keywords like "use", "Awesome_business", "best", "increase", "profit"
Offer discount for every account which tweets will contains keywords listed above.
Does anyone have a better idea about how to go about this?
You could try leveraging Twitter's Streaming API: https://dev.twitter.com/docs/streaming-apis
So you can open a connection and you'll receive tweets as they occur, instead of having to periodically check (plus if there are more than 10 tweets in the last 5 min then you just lost those extras).
Also twitter's search API doesn't allow for specific times, you can only give it a day, so the best you could do is pull all tweets from the last day, and then manually parse the data to find tweets in the specific amount of time from your last poll.
Twitter's API also let's you do hashtag filtering, so you can just grab all tweets with a hashtag relevant to your business, and then reward those people specifically? would make it easier on you so you don't have to write any parsing logic on your end.
So after scouring the youtube API, and thinking that this may not be possible, I'll give a last try here.
In a nutshell, I am trying to obtain analytical data from youtube's analytics's API for specific videos for a date range (by day if possible). I've found ways to get the channel data that the video reside in, but I have been unable to find how to ontain the specific video data itself. Assuming it exists in v3 that is.
Anyone had any luck with this kind of task at all? Has this feature been developed for v3 as of yet?
Channel Reports is the API to retrieve video metrics. It can filter by video, by country, by lead (for some fields) and accepts timespan and data aggregation granularity. In brief, Available Reports lists all the valid query parameter combinations.
Individual comments can be retrieved with v2 Data API - together with their dates.