1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

untweaked and retweaked Tweet

This commit is contained in:
Dave C-J 2013-10-02 23:37:26 +01:00
parent e316c4734f
commit 5c8b2f20db
2 changed files with 14 additions and 16 deletions

View File

@ -102,19 +102,17 @@
</script>
<script type="text/x-red" data-template-name="twitter in">
<div class="form-row">
<div class="form-row">
<label for="node-input-operation"><i class="icon-search"></i> Search</label>
<select type="text" id="node-input-operation" style="display: inline-block; vertical-align: top; width:60%;">
<option value="false">All public Tweets seen by</option>
<option value="true">People being followed by</option>
</select>
</div>
<div class="form-row">
<label for="node-input-twitter"><i class="icon-user"></i> User</label>
<input type="text" id="node-input-twitter">
</div>
<div class="form-row">
<label for="node-input-operation"><i class="icon-search"></i> Search</label>
<select type="text" id="node-input-operation" style="display: inline-block; vertical-align: top;">
<option value="words">Tweets</option>
<option value="user">Users</option>
<!--<option value="site">Site</option> -->
</select>
</div>
<div class="form-row">
<label for="node-input-tags"><i class="icon-tags"></i> For</label>
<input type="text" id="node-input-tags" placeholder="comma-separated words, @ids, #tags">
@ -127,11 +125,12 @@
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-tips">Tip: Use commas without spaces between multiple search terms. Comma = OR, Space = AND.</div>
<div class="form-tips">Tip: Use commas without spaces between multiple search terms. Comma = OR, Space = AND.
<br/>Note: the Twitter API WILL NOT deliver 100% of all tweets...</div>
</script>
<script type="text/x-red" data-help-name="twitter in">
<p>Twitter input node. Watches the public stream for tweets containing the configured search term.</p>
<p>Twitter input node. Watches either the public or the user's stream for tweets containing the configured search term.</p>
<p>Sets the <b>msg.topic</b> to <i>tweets/</i> and then appends the senders screen name.</p>
<p>Sets <b>msg.location</b> to the tweeters location if known.</p>
</script>
@ -143,7 +142,7 @@
defaults: {
twitter: {type:"twitter-credentials",required:true},
tags: {value:"",required:true},
operation: {value:"words",required:true},
operation: {value:"false",required:true},
name: {value:""},
topic: {value:"tweets"}
},

View File

@ -27,7 +27,7 @@ RED.nodes.registerType("twitter-credentials",TwitterNode);
function TwitterInNode(n) {
RED.nodes.createNode(this,n);
this.active = true;
this.oper = n.operation;
this.user = n.user;
this.tags = n.tags.replace(/ /g,'');
this.twitter = n.twitter;
this.topic = n.topic;
@ -46,8 +46,7 @@ function TwitterInNode(n) {
if (this.tags !== "") {
try {
var thing = 'statuses/filter';
if (this.oper === "user") { thing = 'user'; }
if (this.oper === "site") { thing = 'site'; }
if (this.user == "true") { thing = 'user'; }
function setupStream() {
if (node.active) {
twit.stream(thing, { track: [node.tags] }, function(stream) {