Find all comments matching a query on different youtbue videos - youtube-api

I know it is possible to list comments for a single video on youtbue but is it possible to find all comments on youtbue data api v3 that match a query?
For example if I search for "BMW" I find all comments on different videos with "BMW" in it. If it is not supported what would be a work around?
I am using python.

Comments: list Returns a list of comments that match the API
request parameters.
There is a filter parameter which will return the only certain comment ids, (why you would want to do this no idea)
id string The id parameter specifies a comma-separated list of
comment IDs for the resources that are being retrieved. In a comment
resource, the id property specifies the comment's ID.
For the Google methods that do allow you to do a string search (Which is what I think you are looking for) the parameter is normally q.
search.list has this option you can search for videos by text string, Google drive file.list also has it you can search for files that start with a name or type.
Answer: by checking the documentation we can see that it is not possible to find all comments on YouTube Data API v3 that match a string query.

Related

Microsoft Graph API using filter on get sharepoint lists

I'm trying to filter on the sharepoint lists, but the semantics seems to be different to the default semantics.
What I already tried was (with $ and without; single quotes and no quotes):
https://graph.microsoft.com/v1.0/sites/root/lists?filter=name eq 'Something'
https://graph.microsoft.com/v1.0/sites/root/lists?$filter=name eq 'Something'
https://graph.microsoft.com/v1.0/sites/root/lists?filter=id eq 'CFFF1460-B4D7-419C-A921-61B5279BBDDC'
https://graph.microsoft.com/v1.0/sites/root/lists?$filter=id eq 'CFFF1460-B4D7-419C-A921-61B5279BBDDC'
https://graph.microsoft.com/v1.0/sites/root/lists?filter=id eq CFFF1460-B4D7-419C-A921-61B5279BBDDC
https://graph.microsoft.com/v1.0/sites/root/lists?$filter=id eq CFFF1460-B4D7-419C-A921-61B5279BBDDC
But everything returns an array containing all lists and not only the subset matching the desired criteria.
So how can I filter on sharepoint lists?
If you know the id of the list you want to filter and get a response for.
YOu can run a graph API query like this.
https://graph.microsoft.com/v1.0/sites/root/lists/{list-id}
This will give you data about that list.
Let me know if you need further details on this.
Unfortunately (like Marc already mentioned in the comments) it is not possible to filter on SharePoint lists. If you need to, you have to do it on the client side, by reading the list without any filter and make a LINQ statement (or something similar) on the received collection. Be aware that (like all collections in Graph) you don't get always all elements at once. Potentially you have to call the next link request from the last response and wade through more requests and elements till you find what you need.
So when you found what you need, it is a good idea to store the list id within a memory cache or Redis cache for faster lookups the next time, you need this information.

exclude term in YouTube Data API without including term

I'm using the YouTube Data API's search.list method to return a list of videos by date. I'm interested in filtering out certain content without having to specify a search term. The documentation specifies that you can use the - operator as a Boolean NOT, but this only seems to work if I precede that with a search term, meaning I can do this:
q:'food -pizza'
which will return results for the query term 'food' but not 'pizza'. Now say I want it to return any result excluding pizza you'd think this would work:
q:'-pizza'
but this returns an empty Array (no results). Am I doing this wrong? is there a way to exclude certain terms without having to specify a specific search term to include before hand?

Foursquare API - Search By Address

I am using the venues/search API in my app and I am getting some strange results: https://developer.foursquare.com/docs/venues/search.
If I send in the query "1 Irving", as if a user is searching for an address, the list of results returned by Foursquare contains irrelevant venues. From looking at the documentation, I would guess that this is because the "query" parameter of the API is only searching against venue names, and not addresses.
If that is the case, does anyone know if there is any way to get the API to search against address information also? It seems the Foursquare and Swarm apps both do this when searching, as the results for "1 Irving" are much more relevant when I try there.
Edit: including screenshot from Foursquare app
In the venues/search documentation it mentions that if you set intent=match you can include an address parameter.
Finds venues that are are nearly-exact matches for the given
parameters. This intent is highly sensitive to the provided location.
We recommend using this intent only when trying to correlate an
existing place database with Foursquare's. The results will be sorted
best match first, taking distance and spelling mistakes/variations
into account.
query and ll are the only required parameters for this intent, but
matching also supports phone, address, city, state, zip, and twitter.
There's no specified format for these parameters—we do our best to
normalize them and drop them from the search if unsuccessful.
However you still need to provide a query parameter that would be the venue name. I don't believe an endpoint exists to lookup a venue with nothing but an address.
Just from taking a quick look at the docs, it seems like you can just pass the location in as the near object rather than the query object. The docs specifically say "A search term to be applied against venue names."

Filter #tag tweets for a specific account using Twitter Streaming API

I am able to get tweets from a specific account using the streaming API. I can also manage to get tweets for specific #tags like below:
endpoint.trackTerms(Lists.newArrayList("twitterapi", "#myTwitter"));
and
endpoint.trackTerms(Lists.newArrayList("twitterapi", "#yolo"));
I wonder how to merge these two queries as I want to get specific tweets (#yolo) from a specific user (#myTwitter)
Code can be found here
https://github.com/twitter/hbc
Take a look to Twitter's documentation on the streaming API, how to track terms:
A comma-separated list of phrases which will be used to determine what
Tweets will be delivered on the stream. A phrase may be one or more
terms separated by spaces, and a phrase will match if all of the terms
in the phrase are present in the Tweet, regardless of order and
ignoring case. By this model, you can think of commas as logical ORs,
while spaces are equivalent to logical ANDs (e.g. ‘the twitter’ is the
AND twitter, and ‘the,twitter’ is the OR twitter).
twitter-hbc only allows to track terms separated by commas, so if you do this,
endpoint.trackTerms(Lists.newArrayList("#myTwitter", "#yolo"));
You will actually be doing #myTwitter OR #yolo, take a look to the implementation of the method trackTerms,
/**
* #param terms a list of Strings to track. These strings should NOT be url-encoded.
*/
public StatusesFilterEndpoint trackTerms(List<String> terms) {
addPostParameter(Constants.TRACK_PARAM, Joiner.on(',').join(terms));
return this;
}
Instead of using trackTerms, you could add the terms directly to the endpoint like this,
endpoint.addPostParameter(Constants.TRACK_PARAM, Joiner.on(' ').join(Lists.newArrayList("twitterapi", "#yolo")));
Or of course you could create a new method.
Hope it helps.

Applying distinct on specific field in CloudSearch query

I am examining AWS CloudSearch for system's new searching engine.
Assume that there are articles and some comments written on each articles. The search API should return articles that are matching or having any matching comments. So is there any possible way to retrieve DISTINCT values(in this case, unique ID of the article) from CloudSearch with single query execution? If not, what would be the nice solution to resolve this feature's requirement with CloudSearch?
I know there's text-array type for document field in CloudSearch but it seems expensive to update documents since N of comments on single article can be more than thousands.
I faced similar problem, putting comments is not an option in your case as array elements cannot be more than 1000 in cloudsearch. I will make two search domains, articles and comments. I will issue search query to both of them in parallel (async or multithreaded depending upon the language), articles will always generate non duplicate ids but on the results of comments query you have to apply the logic to an article id only once and always pick the top one, as results are sorted by matching score.

Resources