Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the Twitter API call to follow a UserId set #19

Merged
merged 4 commits into from
Aug 14, 2019

Conversation

garretcarrot
Copy link

@garretcarrot garretcarrot commented Mar 18, 2019

Background information

For the use case of tracking a user's tweets/replies/mentions, the filter.keywords property can be exploited to scan for tweets containing the user's Twitter handle. This is supported by the "track" request paramater of the API endpoint, and can sometimes perform acceptably for mentions and replies.

But to select for a user's tweets themselves, only in the rare case that a user's tweet contains their own username will it be captured—since the matching keywords must appear somewhere in the tweet body. Otherwise, the connector currently has no way of tracking tweets originating from a given account.

However, the API also provides us with a follow request parameter (see the doc referred to above), which can bring to bear the desired tweets.

Implementation summary

  • Add a configuration option that is a set (maybe empty) of Twitter UserId values to follow
  • Add the UserId set to the FilterQuery via its follow method

Before & after

After this change, the filter.userIds property, a comma-separated list of UserId values will be allowed (which could be an empty string, which is the default), and if specified will allow the connector to follow tweets originating from, replying to, or mentioning the listed users.

In addition, the connector will continue to track all other tweets that contain any specified filter keywords in their text.

@mitch-seymour
Copy link

nice 👍

@jcustenborder jcustenborder changed the base branch from master to 0.3.x August 14, 2019 19:50
@jcustenborder jcustenborder merged commit 42cd933 into jcustenborder:0.3.x Aug 14, 2019
@jcustenborder
Copy link
Owner

Sorry about the delay. This is merged and will be in the next release.

jcustenborder added a commit that referenced this pull request Aug 14, 2019
* Change the Twitter API call to follow a UserId set (#19)

* Change the Twitter API call to follow a UserId set

* Default to empty set when userIds unspecified

* README: note filter.userIds in configuration list

* Fix userIds default value

* Correct logic to determine the number of tasks to use. Added unit test to ensure logic is valid. Fixes #15.

* Moved to use SourceRecordDeque for temporary record storage. This will ensure that the task will properly exit. Fixes #20.

* Updated parent pom to the latest version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants