Get Region of the video viewers using YouTube API - youtube-data-api

I'm in the research using YouTube-Data-Api. I get like count, comment count like that. I need to get region(Country) list of the viewers of that video one by one in my list. How do I get that.

No you can't, it is only for user who upload the video. In youtube api v3 docs. A url is given something like
https://www.googleapis.com/youtube/v3/videos?id={video->id}&key={$key->key}&part=snippet,contentDetails,statistics,status&regionCode=es
The part of url in which regionCode is given by you. It is only application if The regionCode parameter instructs the API to select a video chart available in the specified region. This parameter can only be used in conjunction with the chart parameter. The parameter value is an ISO 3166-1 alpha-2 country code. For more information You can use this below link.
https://developers.google.com/youtube/v3/docs/videos/list#chart
Hope it helps you.

Related

Filter results from YouTube data API based on date

I am trying to filter data from YouTube data API (using commentThreads).
Goal here is to get all the comments published for the channel after 2018-03-25. I have tried different date formats and it looks like the filter is not working as I get all the results back.
Any ideas?
https://www.googleapis.com/youtube/v3/commentThreads?part=snippet&allThreadsRelatedToChannelId=UCU34OIeAyiD4BaDwihx5QpQ&key=xxxx&maxResults=100&publishedAfter=2018-03-25T13:15:30Z
I've never used the Youtube google api, but assuming that this is the API reference: https://developers.google.com/youtube/v3/docs/commentThreads/list
It doesn't mention the publishedAfter-option, which leads me to believe that it doesn't exist?
This probably means that you'll need to use the order option along with maxResults to achieve your goal.

How to get share count of an url in Google Plus by passing only url

I want to get share count for a particular url from Google Plus.I tried by passing activity id in Activities: get to get share count. It is working fine but I want the same by passing only url alone.
In Facebook I passed only the Url as input in query url with input url and i got share counts for an url.Is there any ways available in Google Plus to get the share count by passing only url.
Referred site:
jonathanmoore/gist:2640302
Welcome to the world of Google APIs. The method in question
Activites.get
GET https://www.googleapis.com/plus/v1/activities/activityId
Takes a single parameter
activityId string The ID of the activity to get.
This is how this method works you must pass an activityId to it you can not pass a url. I can suggest running an Activies.list first in order to find the activity you seek.
You're best option is to use the Search API. Use the URL as the search term and page through all of the results until no more are found. You then have a number for how many times the URL has been shared publicly on Google+.

RegionCode in YouTube API v3

I can't seem to find any information on the implications of using/not using regionCode in the YouTube v3 API, for example the search/list resource.
In the specific, if the regionCode is not specified in the call to the API, will all the videos matching the criteria be returned?
If a video is allowed only in certain regions, not specifying the regionCode in the search request, will the API return it? Or only the unrestricted videos will be returned?
Where can I find some clarification on the topic?
If you do not specify the Region Code then the API automatically determines the region based on your location. So, for example, if I queried the API on my laptop in New Zealand, then the region code would be NZ.
The API outputs the region code. In JSON it is under the tag regionCode.
Generally Region Code is not required. You will get a good matching results output without it.
The regionCode parameter instructs the API to return search results for the specified country. The parameter value is an ISO 3166-1 alpha-2 country code. (string)

Can I obtain the country name with Google Places API?

On the request for current place I receive a list of places. Every place has an address but that address is a string so I can't get only the country name.
Could someone help me on this matter?
Country is only explicitly available when using the Place Details API, not the Places API. (https://developers.google.com/maps/documentation/places/web-service/details)
You first need to look up a place_id for the specific place you're looking for. You then use your place_id to pull details from the Details API, which includes information like:
Fully formatted address, including country
Address components
Sample reviews
Phone # and website
Operating hours
If you have read the Google Places Autocomplete doc,you must know about API properties.you can use the type as '(region)' and will return you many results (plus country).And if you look inside address_components field (it's array with dynamic length),you will see,that the last item of array is what you need.Here is a great page to read a correct doc and try examples yourself.
http://www.w3docs.com/learn-javascript/places-autocomplete.html

Youtube API v3 Search own videos by tag

Is it possible to search videos by tags using Youtube API v3 ?
I would like to search among my own videos.
Use search method with ##tagname search string for q parameter and set type:video parameter. You can find other search operators here. Old one - tag:tangle doesn't work with new api for me. ## works fine.
Recently tried the solution given by user 350D, but q=##{YOUR_TAG} does not appear to work with the latest YouTube API. It appears that the tag can only be retrieved when the video ID is provided as a parameter. I found that the following works for me:
First, retrieve a list of videos (returning minimal needed information, e.g. the video ID, title, and the high quality thumbnail URL):
https://www.googleapis.com/youtube/v3/search?key={YOUR API KEY}&fields=items(id(videoId),snippet(title,thumbnails(high(url))))&part=id,snippet;
Then batch the video IDs into one request to retrieve the associated tags:
https://www.googleapis.com/youtube/v3/videos?key={YOUR API KEY}&fields=items(id,snippet(tags))&part=snippet&id={videoID01,videoID02,etc};
You can do a videos->list with with settings video ids as the ones in your playlist and iterate through them checking with tags. But searching by tags is not available in API anymore.

Resources