private FilterQuery createFilter() { FilterQuery filterQuery = new FilterQuery(); try { filterQuery.track(KEYWORDS); } catch (Exception e) { LOGGER.error(e.getMessage(), e); throw new IllegalArgumentException(e); } return filterQuery; }
filterQuery = new FilterQuery(); if (trackValue.contains(",")) { keywords = trackValue.trim().split(",\\s*"); keywords = new String[] { trackValue }; filterQuery = filterQuery.track(keywords); filterQuery = new FilterQuery(); languages = new String[] { langValue }; filterQuery = filterQuery.language(languages); if (locations != null) { if (filterQuery == null) { filterQuery = new FilterQuery(); filterQuery = filterQuery.locations(locations); String filterValue = configuration.get(ConfigurationConstants.FILTER_LEVEL); if (filterValue != null) { filterQuery = filterQuery.filterLevel(filterValue);
private FilterQuery createFilter() { FilterQuery filterQuery = new FilterQuery(); String allLocationsString = endpoint.getProperties().getLocations(); if (allLocationsString != null) { locations[i][1] = Double.valueOf(coords[1]); filterQuery.locations(locations); filterQuery.track(keywords.split(",")); longUserIds[i] = Long.valueOf(stringUserIds[i]); filterQuery.follow(longUserIds);
FilterQuery query = new FilterQuery(); if (languages != null) { query.language(languages); query.track(tracks); query.follow(follow); query.locations(locations); query.filterLevel(filterLevel); query.count(count); twitterStream.filter(query);
/** * Construct the dataset from the given API token. The stream is backed by * an {@link ArrayBlockingDroppingQueue} with a single item capacity. * * @param words * the query terms * @param token * the Twitter api authentication credentials */ public TwitterStreamFilterDataset(String[] words, final TwitterAPIToken token) { this(new FilterQuery(0, null, words), token); }
final FilterQuery filterQuery = new FilterQuery(); filterQuery.locations(boundingBoxOfUS); this._twitterStream.filter(filterQuery);
public static void start() { if (ClientConfig.TWITTER() != null) { ClientConfig.TWITTER().addListener(new TwitterListener()); long[] twitterIDs = new long[Language.values().length]; int i = 0; for(Language lg : Language.values()) twitterIDs[i++] = Long.parseLong(Translator.getLabel(lg, "twitter.id")); ClientConfig.TWITTER().filter(new FilterQuery(0, twitterIDs, new String[]{})); } } }
@Override public TwitterStream filter(final String... track) { filter(new FilterQuery().track(track)); return this; }
/** * Asynchronously retrieves public statuses that match one or more filter predicates. * <p/> * At least a keyword or userId must be specified. Multiple parameters may be * specified. * <p/> * Placing long parameters in the URL may cause the request to be rejected for excessive URL length. * <p/> * The default access level allows up to 200 track keywords and 400 follow userids. * <p/> * Only one Twitter stream can be consumed using the same credentials. As a consequence, * only one twitter stream can be consumed per connector instance. * <p/> * {@sample.xml ../../../doc/twitter-connector.xml.sample twitter:filteredStream} * * @param count the number of previous statuses to stream before transitioning to the live stream. * @param userIds the user ids to follow * @param keywords the keywords to track * @param callback the {@link SourceCallback} used to dispatch messages when a response is received */ @Source public void filteredStream(@Default("0") int count, @Placement(group = "User Ids to Follow") @Optional List<String> userIds, @Placement(group = "Keywords to Track") @Optional List<String> keywords, final SourceCallback callback) { listenToStatues(callback).filter(new FilterQuery(count, toLongArray(userIds), toStringArray(keywords))); }
@Override public void start(Map<String, String> map) { this.config = new TwitterSourceConnectorConfig(map); TwitterStreamFactory twitterStreamFactory = new TwitterStreamFactory(this.config.configuration()); this.twitterStream = twitterStreamFactory.getInstance(); String[] keywords = this.config.filterKeywords.toArray(new String[0]); if (log.isInfoEnabled()) { log.info("Setting up filters. Keywords = {}", Joiner.on(", ").join(keywords)); } FilterQuery filterQuery = new FilterQuery(); filterQuery.track(keywords); if (log.isInfoEnabled()) { log.info("Starting the twitter stream."); } twitterStream.addListener(this); twitterStream.filter(filterQuery); }
FilterQuery fq = new FilterQuery(); fq.track(new String[]{ track }); stream.filter(fq); notifyStarted();
_twitterStream.addListener(listener); FilterQuery filter = new FilterQuery(); filter.track(new String[]{"android"}); _twitterStream.filter(filter);
logger.debug("Starting up Twitter filtering..."); FilterQuery query = new FilterQuery().track(keywords); twitterStream.filter(query);
cb.setJSONStoreEnabled(true); TwitterStream twitterStream = new TwitterStreamFactory(cb.build()).getInstance(); FilterQuery fq = new FilterQuery(); fq.track(TwitterConfig.hashtags); twitterStream.addListener(listener); TweetsProcessor processor = new TweetsProcessor(twitterStream);