YouTube Data Search API with no query - youtube-api

I have a question about the Search endpoint:
https://developers.google.com/youtube/v3/docs/search/list
You can run this without specifying a query (q) parameter, in fact without specifying almost anything.
My question is - if I run the API request with only type=channel or type=video, how will the API decide what to return?

It will return whatever you indicate in the "fields" parameter. You can try it here in Youtube API Explorer, just click Execute.
You can see the list of parameter you can use for fields here.

Related

How to use YouTube API with Videos:List and Channel ID?

I want to monitor my YouTube Live stream without using Search:List. How do I use YouTube API with Videos:List and Channel-ID instead of Video-ID? Use of chart filter in conjunction with videoCategoryId parameter seems a potential solution but I fail to construct the URL correctly. I have tried the following urls. The problem with URL #1 is that I have to specify video ID which changes every time the stream restarts.
Successful URLs #1
https://www.googleapis.com/youtube/v3/videos?part=snippet&id=[Video ID]&key=[API KEY]
https://www.googleapis.com/youtube/v3/videos?part=liveStreamingDetails&id=[Video ID]&key=[API KEY]
This URL don't work #2
https://www.googleapis.com/youtube/v3/videos?part=snippet&chart=videoCategoryId=[Channel ID]&key=[API KEY]
chart=videoCategoryId=[Channel ID] is incorrect, you should instead use chart=mostPopular&videoCategoryId=VIDEO_CATEGORY_ID VIDEO_CATEGORY_ID being one listed by VideoCategories: list as documented chart and videoCategoryId. You are trying frantically to provide your channel id to a parameter (videoCategoryId) not accepting one.
Please don't make duplicated questions and update instead your old question, as I commented it and it may solve the problem you raised here.

knime youtube api search result next page

I am using the example server provided by knime to get youtube search result. But I am only able to get maximum 50 results. how do I get access to more results?
https://www.knime.com/nodeguide/data-access/rest-web-services/access-youtube-rest-api
Since it's using Youtube API, you'll be using nextPageToken to access the next results. So in your case that would be 51-100. The prevPageToken does the opposite.
pageToken
The pageToken parameter identifies a specific page in the result set
that should be returned. In an API response, the nextPageToken and
prevPageToken properties identify other pages that could be retrieved.
You can try here in Google API
Explorer.
Authorize and Execute. If there's more than 50 result, you'll notice a nextPageToken in the JSON response. Place that in the "pageToken" property and execute again. You'll be given the 51-100 results. The same thing happens with 101-150 and so forth.

youtube data api v3 search with hashtags

It seems https://developers.google.com/youtube/v3/docs/search with the query parameter as a literal hashtag value does not return the same result as the UI (youtube.com) does.
The search results are however similar if the '#' is removed.
Is this intended behavior or a bug in the API?
Also, if we hit search/list without order parameter, we do get results. Otherwise not.

How to get all comments on a YouTube video?

Since Google has deprecated the YouTube v2 API, I cannot find a way to get all the comments from a video.
Is it possible to use a single, non-deprecated API (Google+, YT v3) to do that?
I am not concerned about maintaining threading.
Believe me it works
https://www.googleapis.com/youtube/v3/commentThreads?key=******************&textFormat=plainText&part=snippet&videoId=kffacxfA7G4&maxResults=50
Key will be provided by the google developer console and 50 denotes 50 comments in form of a json, video id is the id of the video. For any type of queries comment below.
You can get only 100 at most at a time with the comments API. But you get a nextPageToken from the comment api response. Pass &pageToken={nextPageToken} to next api call, until the nextPageToken is undefined. Then you can get all comments if you like.
https://www.googleapis.com/youtube/v3/commentThreads?key={your_api_key}&textFormat=plainText&part=snippet&videoId={video_id}&maxResults=100&pageToken={nextPageToken}
Apparently it is now possible to fetch comment threads.
(old answer)
Currently that's impossible with a first-party tool.
Source:
While v3 offers the majority of v2 functionality, there are currently
a couple of tasks that can only be done with the older API.
Specifically, applications that manage captions or that work with
video comments still need to use the v2 API until modern equivalents
are available. Our goal is to provide similar functionality well
before the April 2015 shut-off date—please subscribe to this blog, the
YouTube Data API v3 revision history page, or follow +YouTubeDev on
Google+ to keep up-to-date. -
http://apiblog.youtube.com/2014/03/committing-to-youtube-data-api-v3.html
TubeKit (YouTube crawling toolkit) might be of help to some.
You can fetch all the comments using https://www.googleapis.com/youtube/v3/commentThreads
The Youtube API v3.0 allows you the following parameters.
textFormat - This parameter indicates whether the API should return comments formatted as HTML or as plain text. The default value is html.
videoId - The Youtube Video ID you want to fetch comments for ( if you dont know your Youtube Video ID, you can get one from Youtube Video ID Finder )
maxResults - The maxResults parameter specifies the maximum number of items that should be returned in the result set.
pageToken - The pageToken parameter identifies a specific page in the result set that should be returned. In an API response, the nextPageToken property identifies the next page of the result that can be retrieved.
$.ajax({
dataType: "jsonp",
type: 'GET',
url: "https://www.googleapis.com/youtube/v3/commentThreads?key=PUT-YOUR-KEYXXXXXXX&textFormat=plainText&part=snippet&videoId=PUT-YOUR-VIDEO-ID",
success: function(result){
data = result;
$('.data').text(data);
console.log(data);
}});
To find PUT-YOUR-KEY(API key) ---> https://console.developers.google.com/apis/credentials then click on blue color button select API key option you can get

Is there a way to use since_id and max_id in Twitter's Search API?

I'm trying to get the search results between two specific id's but it seems to ignore the ids, here is a sample of my query:
http://search.twitter.com/search.json?since_id=58308825907871744&q=%23twitter&rpp=100&max_id=58309448581660674
It just throws back the same set of results if I change the ids. Any ideas?
Unfortunately, the search API doesn't support a max_id parameter. It features an until parameter instead, which is specified as a date rather than a status ID. So, you would have to reformat your query something like the following:
http://search.twitter.com/search.json?since_id=58308825907871744&q=%23twitter&rpp=100&until=2011-04-14
Twitter API issue 2052 details Twitter's response to the very issue that you raise.
Note that in v1.1 max_id is supported on the search api.
https://dev.twitter.com/rest/reference/get/search/tweets#api-param-max_id

Resources