I'm trying to test this code to get a real-time streaming of tweets from Twitter:
var PubNub = require('pubnub')
var pubnubTwitter = new PubNub({
subscribeKey: "sub-c-788-redacted",
})
pubnubTwitter.addListener({
message: function(m) {
var msg = m.message;
if (msg.text.match(/([T|t]rump|[P|p][O|o][T|t][U|u][S|s])/g)) {
console.log(msg.text);
}
}
})
pubnubTwitter.subscribe({
channels: ['pubnub-twitter'],
})
I'm not sure if this is the right way to use the key that is provided by PunNub and not mine?
Also, is filtering tweets is an option in PubNub? "like the method in (Tweepy library in python)" Because I only want tweets from specific country and in specific language.
Thank you in advance.