Is there a way in Spring Social Twitter to search for tweets but exclude retweets? Currently I use the search method like this but I finds - of course - also retweeted tweets.
twitter.searchOperations().search('stackoverflow', 100)
May be little late to answer, but its actually now possible to filter out the retweets from search results.
"puppy -filter:retweets" containing “puppy”, filtering out retweets
So, in above case with Spring Social, you can just change the query to
twitter.searchOperations().search('stackoverflow -filter:retweets', 100)
This would return all tweets containing stackoverflow, and filter out retweets.
You can check all search operators for standard(Free) API.
Regarding to the Twitters API 1.1 it's currently not possible to exclude retweets when searching for tweets. Nevertheless I have overlook Spring model class org.springframework.social.twitter.api.Tweet for a tweet. The is a property retweet on that class that can be use to filter the result.
Related
I'm looking for the correct API for the events that show up in a regular Google Search, the ones that are structured (with name, datetime, location)
Any help or guidance is appreciated
I have tried the Custom Search with no luck, and also the Calendar API (which seems to require a calendar ID, more so for personal calendars or targeted public ones)
We've actually just made an API to scrape the Google event results. You can query it directly like this:
https://serpapi.com/search.json?engine=google_events&q=Events+in+Austin
Or if you are using Ruby, you can do something like this:
require 'google_search_results'
params = {
engine: "google_events",
q: "Events in Austin",
}
client = GoogleSearchResults.new(params)
events_results = client.get_hash[:events_results]
Some documentation: https://serpapi.com/google-events-api
I had a quick look - while I didn't find a fully programatic API yet, here are two things that can get you started on more:
How to search the events page directly: use the following URL schema: https://www.google.com/search?q=cool+conferences&oq=cool+conferences&ibp=htl;events&rciv=evn - replacing "cool+conferences" with any string you like - this can let you create dynamic URLs for event searches.
How to access event metadata for a given page - google is pushing a standard to structure data on webpages to support "smart" searches such as for events. They are using a data structure called JSON-ld. More details. If you want to read such metadata from a webpage, here is one scraper I have found that does that - extruct (though I didn't get a change to test it yet).
Hope this helps :)
I have a list of subjects that can be registered to students. A subject has a property maxParticipants.
Example:
Subject: Spanish
Max Participants: 5
I want to update the available subject places by a Spring Flux with a given interval. This is no problem (every 10s i do a select count on the datasource to get the available places).
My question is:
How do i update the frontend being rendered with thymeleaf?
There are numerous examples using thymeleaf and spring webflux but all of them are dealing with a large list where the #Controller Model is set with a certain thymeleaf type.
I just want to update existing records.
Do i need to do this with plain javascript/jquery?
Thanks for your tips!
Thomas
You should use EventSource in the web page. Follow example
https://www.mkyong.com/spring-boot/spring-boot-webflux-server-sent-events-example/
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.
I have a REST service /accounts which returns all the accounts data (Number, Name).
Requirement :
Should Support the below search/filter pattern with any combination of "And" or "OR" rather than retruning the entire collection.
startsWith
endsWith
Contains
Question 1 : Are these below API design correct(RESTful) or any better way to do the same
e.g -
/accounts?name^My Account 123**or**number~ACC1234
(^"==> Starts with , "~"==> ends with)
/accounts?name^My Account 123**and**number~ACC1234
(^"==> Starts with "~"==> ends with)
/accounts?name$ACC123
($ ==> account collection contains ACC123)
Spring Controller:
Planning to get these Filter (Query Parameter) pattern as #RequestParam and have a Regex to parse the pattern and then apply & retrieve it from the data store. The downside is any new filter pattern would need a change in the Controller class.
Question 2: Is there any out of the box features available in Spring 3 to do search / filter from a collection?
Thanks!
From a design perspective, using Query parameters to specify search / filter parameters is fine. However, for more complex cases such as yours, I typically define a new end point, that only deals with searches.
As an example, if my logic for search is strictly "or" and "contains", I would define a book search as such:
GET /books/?author=john&keywords=how%20to%20use%20spring
Here, my API is strictly going to search for books where the author's name contains "john" and the words "how to use spring" appear in the content. The Search logic stays consistent, and the client has no flexibility.
In your case, if the client has the ability to specific their own search criteria, you need to build out a new end point, something like:
POST /books/search
And in the request body, post your own search criteria DSL like name^My Account 123**and**number~ACC1234
I store specific custom field for each transaction. I'd like to conduct a search by this field. I wouldn't like to retrieve too many transactions (can filter by payment method id, but still) and iterate through them on application side. So, I read a documentation, didn't find an ability to search by custom field (only by predefined). I didn't try it out, but probably it's possibly to do so by following the same pattern like
var stream = gateway.transaction.search(function (search) {
search.myCustomField().is("custom_field_value");
// or search.customFields.myCustomField().is("custom_field_value");
});
Thanks in advance
I work as a developer for Braintree. Searching on custom fields is not supported at this time. You can see all of the searchable transaction attributes listed here.
If you would like to discuss alternatives, I recommend emailing our support team at support#braintreepayments.com to see if there is another method to achieve what you are trying to do.