Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #26961 > unrolled thread

How do I change the tracking keyword for a twitter stream using the app.get()

Started byaryaksengupta@gmail.com
First post2015-03-03 02:33 -0800
Last post2015-03-04 07:28 -0800
Articles 14 — 4 participants

Back to article view | Back to comp.lang.javascript


Contents

  How do I change the tracking keyword for a twitter stream using the app.get() aryaksengupta@gmail.com - 2015-03-03 02:33 -0800
    Re: How do I change the tracking keyword for a twitter stream using the app.get() "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-03-03 13:01 +0100
      Re: How do I change the tracking keyword for a twitter stream using the app.get() Scott Sauyet <scott.sauyet@gmail.com> - 2015-03-04 07:43 -0800
        Re: How do I change the tracking keyword for a twitter stream using the app.get() "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-03-04 17:37 +0100
          Re: How do I change the tracking keyword for a twitter stream using the app.get() "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-03-04 18:42 +0100
            Re: How do I change the tracking keyword for a twitter stream using the app.get() "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-03-04 19:46 +0100
              Re: How do I change the tracking keyword for a twitter stream using the app.get() "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-03-04 20:29 +0100
                Re: How do I change the tracking keyword for a twitter stream using the app.get() "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-03-04 20:39 +0100
                  Re: How do I change the tracking keyword for a twitter stream using the app.get() Scott Sauyet <scott.sauyet@gmail.com> - 2015-03-04 12:26 -0800
          Re: How do I change the tracking keyword for a twitter stream using the app.get() Scott Sauyet <scott.sauyet@gmail.com> - 2015-03-04 11:35 -0800
            Re: How do I change the tracking keyword for a twitter stream using the app.get() "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2015-03-04 20:44 +0100
              Re: How do I change the tracking keyword for a twitter stream using the app.get() Scott Sauyet <scott.sauyet@gmail.com> - 2015-03-04 12:44 -0800
              Re: How do I change the tracking keyword for a twitter stream using the app.get() "Christoph M. Becker" <cmbecker69@arcor.de> - 2015-03-04 21:52 +0100
    Re: How do I change the tracking keyword for a twitter stream using the app.get() Scott Sauyet <scott.sauyet@gmail.com> - 2015-03-04 07:28 -0800

#26961 — How do I change the tracking keyword for a twitter stream using the app.get()

Fromaryaksengupta@gmail.com
Date2015-03-03 02:33 -0800
SubjectHow do I change the tracking keyword for a twitter stream using the app.get()
Message-ID<38ee1925-dfed-4cc9-a2a8-4ba5ea028e35@googlegroups.com>
Hi everyone, 

I am new to Nodejs and Socket.io. I have worked through a tutorial which describes how both the technologies work together. The link to the tutorial is this :--- >  Build a real-time Twitter stream 

and the code for the tutorial is posted at github :---> Code of react-tweets. 

Everything works fine in the tutorial and I also have no issues in understanding the code since the code is well commented.

 In the server.js file, the tracking keyword which is "javascript" is manually fed into the "twit" object. i.e. here is the code for it. 

twit.stream('statuses/filter',{ track: 'javascript'}, function(stream){
  streamHandler(stream,io);
});

But I want to make a minor alteration in the code to make the application a bit more versatile. I want to change the tracking keyword dynamically using the URL entered by the user.

For example, if the URL entered is http://localhost/football, then automatically I want the track keyword to be changed to "football". The code should look like 

twit.stream('statuses/filter',{ track: 'football'}, function(stream){
  streamHandler(stream,io);
});

Now, I tried to set this object inside the app.get("/cricket", twit.stream.......); function but I get an error "Expected callback got object" . 

How do I change the above mentioned code to achieve this?. Please let me know. 

Thanks a lot. 

[toc] | [next] | [standalone]


#26962

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2015-03-03 13:01 +0100
Message-ID<XnsA452846D482CEeejj99@194.109.6.166>
In reply to#26961
aryaksengupta@gmail.com wrote on 03 mrt 2015 in comp.lang.javascript:

> I am new to Nodejs and Socket.io. I have worked through a tutorial which
> describes how both the technologies work together. 

Dear Aryak Sengupta, 

This NG is about Javascript, which most of us think is a computer language.

> Nodejs and Socket.io ... technologies 

Methinks they are libraries, not technologies, 
but then I could be wrong, as that is just semantics.

However this Usenet NG is not a helpdesk, 
and certainly not a helpdesk for specific libraries.

> Thanks a lot. 

For what? 

Please add a signature.

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#26972

FromScott Sauyet <scott.sauyet@gmail.com>
Date2015-03-04 07:43 -0800
Message-ID<22af3491-e963-4bf5-a27c-12987d1286a7@googlegroups.com>
In reply to#26962
Evertjan. wrote:
> aryaksengupta@gmail.com wrote:
> 
>> I am new to Nodejs and Socket.io. I have worked through a tutorial which
>> describes how both the technologies work together. 

> Methinks they are libraries, not technologies, 
> [ ... ] However this Usenet NG is not a helpdesk, 
> and certainly not a helpdesk for specific libraries.

By that same logic, should we avoid discussion of DOM-related questions, 
as they only have to do with one possible host environment for ECMAScript
languages?  Should we skip `setTimeout` and the like?  It might get
pretty quiet here.

  -- Scott

[toc] | [prev] | [next] | [standalone]


#26975

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2015-03-04 17:37 +0100
Message-ID<XnsA453B33D3C246eejj99@194.109.6.166>
In reply to#26972
Scott Sauyet <scott.sauyet@gmail.com> wrote on 04 mrt 2015 in 
comp.lang.javascript:

> Evertjan. wrote:
>> aryaksengupta@gmail.com wrote:
>> 
>>> I am new to Nodejs and Socket.io. I have worked through a tutorial which
>>> describes how both the technologies work together. 
> 
>> Methinks they are libraries, not technologies, 
>> [ ... ] However this Usenet NG is not a helpdesk, 
>> and certainly not a helpdesk for specific libraries.
> 
> By that same logic, should we avoid discussion of DOM-related questions, 
> as they only have to do with one possible host environment for ECMAScript
> languages?  Should we skip `setTimeout` and the like?  It might get
> pretty quiet here.

Wrong, those are platforms, not libraries.

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#26977

From"Christoph M. Becker" <cmbecker69@arcor.de>
Date2015-03-04 18:42 +0100
Message-ID<md7g5f$atn$1@solani.org>
In reply to#26975
Evertjan. wrote:

> Scott Sauyet <scott.sauyet@gmail.com> wrote on 04 mrt 2015 in 
> comp.lang.javascript:
> 
>> Evertjan. wrote:
>>> aryaksengupta@gmail.com wrote:
>>>
>>>> I am new to Nodejs and Socket.io. I have worked through a tutorial which
>>>> describes how both the technologies work together. 
>>
>>> Methinks they are libraries, not technologies, 
>>> [ ... ] However this Usenet NG is not a helpdesk, 
>>> and certainly not a helpdesk for specific libraries.
>>
>> By that same logic, should we avoid discussion of DOM-related questions, 
>> as they only have to do with one possible host environment for ECMAScript
>> languages?  Should we skip `setTimeout` and the like?  It might get
>> pretty quiet here.
> 
> Wrong, those are platforms, not libraries.

The DOM is a platform?  I'll be blowed!

-- 
Christoph M. Becker

[toc] | [prev] | [next] | [standalone]


#26979

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2015-03-04 19:46 +0100
Message-ID<XnsA453C9338BCeejj99@194.109.6.166>
In reply to#26977
"Christoph M. Becker" <cmbecker69@arcor.de> wrote on 04 mrt 2015 in 
comp.lang.javascript:

>> Wrong, those are platforms, not libraries.
> 
> The DOM is a platform?  I'll be blowed!

You are free to smell your own wind.

But yes, depending on definition,
when a language has all it's interface 
on a platform like the DOM, 
why not call a rose a a sweetsmelling rose?


-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#26980

From"Christoph M. Becker" <cmbecker69@arcor.de>
Date2015-03-04 20:29 +0100
Message-ID<md7me5$2i6$1@solani.org>
In reply to#26979
Evertjan. wrote:

> "Christoph M. Becker" <cmbecker69@arcor.de> wrote on 04 mrt 2015 in 
> comp.lang.javascript:
> 
>>> Wrong, those are platforms, not libraries.
>>
>> The DOM is a platform?  I'll be blowed!
> 
> You are free to smell your own wind.

Very funny, as usual. ;)

> But yes, depending on definition,
> when a language has all it's interface 
> on a platform like the DOM, 
> why not call a rose a a sweetsmelling rose?

We're not philosophizing here (this is comp.lang.javascript), so back to
facts.  The W3C (being responsible for the standardization of the DOM)
states[1]:

| This specification defines the Document Object Model Level 2, a
| platform- and language-neutral interface [...]

How could a platform-neutral interface be a platform?  (Hint: this is a
rhetoric question.)

[1] <http://www.w3.org/TR/DOM-Level-2/>

-- 
Christoph M. Becker

[toc] | [prev] | [next] | [standalone]


#26982

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2015-03-04 20:39 +0100
Message-ID<XnsA453D220B5F56eejj99@194.109.6.166>
In reply to#26980
"Christoph M. Becker" <cmbecker69@arcor.de> wrote on 04 mrt 2015 in 
comp.lang.javascript:

>| This specification defines the Document Object Model Level 2, a
>| platform- and language-neutral interface [...]
> 
> How could a platform-neutral interface be a platform?  (Hint: this is a
> rhetoric question.)

Nonsense, you just want so very much think you are right, but you are not.

Just like a table, while not defined by the platform it stands on,
can be a platform itself for cups and spoons,
a "a platform-neutral interface" can "sit on" different platforms,
meaning different browsers, and even so be a platform for Javascript
and other languages.


-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#26987

FromScott Sauyet <scott.sauyet@gmail.com>
Date2015-03-04 12:26 -0800
Message-ID<9a365a81-c5d9-43e2-8972-2fea34fab23e@googlegroups.com>
In reply to#26982
Evertjan. wrote:
> "Christoph M. Becker" wrote:
>> How could a platform-neutral interface be a platform?  (Hint: this is a
>> rhetoric question.)
> 
> Nonsense, you just want so very much think you are right, but you are not.
> 
> Just like a table, while not defined by the platform it stands on,
> can be a platform itself for cups and spoons,
> a "a platform-neutral interface" can "sit on" different platforms,
> meaning different browsers, and even so be a platform for Javascript
> and other languages.

Yours still is a very odd definition.  I still can make no sense of the
notion of the DOM as a platform for Javascript.  A Web browser, yes, but
the DOM is simply an API that the browser supplies, and if there is any
'resting-on' relationship, the DOM API we use is resting atop Javascript,
not vice versa.

  -- Scott

[toc] | [prev] | [next] | [standalone]


#26981

FromScott Sauyet <scott.sauyet@gmail.com>
Date2015-03-04 11:35 -0800
Message-ID<a4c38265-022b-49d5-8622-3927bbc58656@googlegroups.com>
In reply to#26975
Evertjan. wrote:
> Scott Sauyet wrote:
>> Evertjan. wrote:
>> By that same logic, should we avoid discussion of DOM-related questions, 
>> as they only have to do with one possible host environment for ECMAScript
>> languages?  Should we skip `setTimeout` and the like?  It might get
>> pretty quiet here.
> 
> Wrong, those are platforms, not libraries.

That seems a very odd definition of "platform".  Very odd.  Web browsers
provide a host environment for Javascript, and supply a number of APIs 
(DOM, History, XHR, to name a few.)  But those APIs are not part of the
core language itself.  Hint: they're not mentioned in the spec.

The underlying question is why do you feel the need to police what 
portions of the wider Javascript environment people should discuss here?

  -- Scott

[toc] | [prev] | [next] | [standalone]


#26983

From"Evertjan." <exxjxw.hannivoort@inter.nl.net>
Date2015-03-04 20:44 +0100
Message-ID<XnsA453D3049E8E1eejj99@194.109.6.166>
In reply to#26981
Scott Sauyet <scott.sauyet@gmail.com> wrote on 04 mrt 2015 in 
comp.lang.javascript:

> The underlying question is why do you feel the need to police what 
> portions of the wider Javascript environment people should discuss here?

"need to police".

To be effective usenet NGs should be kept on topic,
and this can only be maintained by the users.

So while we can discuss the extent of the on-topic-ness, 
the maintaining is part of the NG user's job.

-- 
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

[toc] | [prev] | [next] | [standalone]


#26988

FromScott Sauyet <scott.sauyet@gmail.com>
Date2015-03-04 12:44 -0800
Message-ID<f708d2f8-9100-427d-aed8-a97061d67c10@googlegroups.com>
In reply to#26983
Evertjan. wrote:
> Scott Sauyet wrote:
> 
>> The underlying question is why do you feel the need to police what 
>> portions of the wider Javascript environment people should discuss here?
> 
> "need to police".
> 
> To be effective usenet NGs should be kept on topic,
> and this can only be maintained by the users.
> 
> So while we can discuss the extent of the on-topic-ness, 
> the maintaining is part of the NG user's job.

ACK

But from the group's charter [1]:

| No applications of javascript/ECMAScript are excluded from 
| discussion on the group, and the group's apparent bias towards
| web browser scripting for the Internet is a consequence of the
| historical origin of the language, and the fact that browser 
| scripting remains its most common application.

Which sounds to me as though if it's about Javascript, we can probably 
give it the benefit of the doubt as to being on topic.


[1]: <http://jibbering.com/faq/faq_notes/cljs_charter.html>


  -- Scott

[toc] | [prev] | [next] | [standalone]


#26989

From"Christoph M. Becker" <cmbecker69@arcor.de>
Date2015-03-04 21:52 +0100
Message-ID<md7r9p$klc$1@solani.org>
In reply to#26983
Evertjan. wrote:

> Scott Sauyet <scott.sauyet@gmail.com> wrote on 04 mrt 2015 in 
> comp.lang.javascript:
> 
>> The underlying question is why do you feel the need to police what 
>> portions of the wider Javascript environment people should discuss here?
> 
> "need to police".
> 
> To be effective usenet NGs should be kept on topic,
> and this can only be maintained by the users.
> 
> So while we can discuss the extent of the on-topic-ness, 
> the maintaining is part of the NG user's job.

I agree that we can discuss what shall be on topic in the future, but
for now the FAQ[1] gives this answer:

| The comp.lang.javascript newsgroup deals with ECMAScript languages,
| so any questions about JavaScript or JScript are welcome. However,
| the majority of questions sent to this group relates to javascript in
| a web browser. If you are experiencing issues with a particular
| browser, or the host is not a browser at all, please make this
| information clear.

The OP mentioned Node.js, so I can't see that the question would be OT.

[1]
<http://jibbering.com/faq/#appropriateQuestions>
<http://pointedears.de/scripts/faq/cljs/#appropriateQuestions>

-- 
Christoph M. Becker

[toc] | [prev] | [next] | [standalone]


#26971

FromScott Sauyet <scott.sauyet@gmail.com>
Date2015-03-04 07:28 -0800
Message-ID<e4207c9c-d24c-4a8c-988b-02c7020b7ee3@googlegroups.com>
In reply to#26961
aryaksengupta@gmail.com wrote:
> I am new to Nodejs and Socket.io. I have worked through a tutorial 
> which describes how both the technologies work together. 

This one?:

    <https://scotch.io/tutorials/build-a-real-time-twitter-stream-with-node-and-react-js>

> Everything works fine in the tutorial and I also have no issues in 
> understanding the code since the code is well commented.

Well, it seems not, or you probably wouldn't have this question!  :-)

> [ ... ]
> Now, I tried to set this object inside the 
> app.get("/cricket", twit.stream.......); function but I get an error 
> "Expected callback got object" . 

Well if you're passing the output of `twit.stream` as the second parameter
to `app.get`, then you do need to reread that tutorial.  `app.get` is 
expecting a route function there:

    function(req, res) {
        // parse req
        // res.render(...) or res.send(...) or other possibilities
    }

HTH,

  -- Scott

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web