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

Twitter API V2.0 public search update #954

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

shahramdj
Copy link

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Proposed changes

Current twitter node does not search public tweets since twitter has upgraded the API to V 2.0. The change that I made solves the problem.

Checklist

  • I have read the contribution guidelines
  • For non-bugfix PRs, I have discussed this change on the forum/slack team.
  • I have run grunt to verify the unit tests pass
  • I have added suitable unit tests to cover the new/changed functionality

@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Oct 7, 2022

CLA Signed

The committers listed above are authorized under a signed CLA.

@hardillb
Copy link
Member

hardillb commented Oct 7, 2022

You should not check in the node_modules directory, please update your local branch to remove it.

You also need to sign the CLA so we can accept the changes.

} else {
self.warn("Failed to get user profile");

const needle = require('needle');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see here you are using needle however needle is not a dependency in this package (request is a dependency).

I am not against using needle (in fact it is a reasonable alternative considering request is depreciated) BUT for me to accept this PR, I would suggest the rest of the HTTP requests are changed to use needle as well.

If you can do that - great.

PS, you would also need to add a dependency in the package.json for needle

}
// Listen to the stream.
// node.status({fill:"green", shape:"dot", text:(node.tags||" ")});
console.log("Twitter API is steraming public tweets with search term " + node.tags || " ");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love the project to upgrade to Twitter 2.0. Would be great to keep the logging consistent with the old node, and avoid console.log() throughout, so node.debug maybe here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion, I will change it.

var params = msg.params || {};
params.status = msg.payload;
if (mediaId) {
params.media_ids = mediaId;
}
node.twitterConfig.post("https://api.twitter.com/1.1/statuses/update.json",{},params).then(function(result) {
node.twitterConfig.post("https://api.twitter.com/1.1/statuses/update.json", {}, params).then(function (result) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So there is this mix of twitter 1.1 for the Twitter Out node, and 2 for the Twitter in node. It would be fantastic to have them both on Twitter 2. At the moment if I use this branch and deploy first a twitter in, and then a twitter out node I get an exception I think because the two configurations of credentials clash 24 Oct 22:45:40 - [info] Updated flows 24 Oct 22:45:40 - [red] Uncaught Exception: 24 Oct 22:45:40 - [error] Error: aborted at connResetException (node:internal/errors:705:14) at TLSSocket.socketCloseListener (node:_http_client:454:19) at TLSSocket.emit (node:events:525:35) at node:net:301:12 at TCP.done (node:_tls_wrap:588:7)

@hardillb
Copy link
Member

hardillb commented Feb 6, 2023

Might want to wait until after the 9th to see what API is still available and at what cost...

@BeeOnLion
Copy link

Hi all

I was wondering if there is any update as to weather or not this is going to be merged into master or is there a timeline on this?

@shahramdj did you manage to get this running with the current version 2 of the twitter API? Or have you reverted back to using a function node to get your tweets out to the world?

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.

5 participants