# Twitter Parsing

**URL:** <https://discourse.nodered.org/t/twitter-parsing/16071>\
**Category:** General\
**Created:** [30 September 2019 01:32 UTC](https://discourse.nodered.org/t/twitter-parsing/16071 "2019-09-30T01:32:26Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Exit2Studios](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/exit2studios/32/10998_2.png) [@Exit2Studios](https://discourse.nodered.org/u/Exit2Studios)\
**Post date:** [30 September 2019 01:32 UTC](https://discourse.nodered.org/t/twitter-parsing/16071/1 "2019-09-30T01:32:26Z")

</div>

I have the twitter node setup and running. I'm able to get specific tweets, but I'm trying to pull out specific data. In this case, game score.

Does anyone have a working function node example that could help guide me in how to best extract only the data I need?

Thank you!

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [30 September 2019 03:49 UTC](https://discourse.nodered.org/t/twitter-parsing/16071/2 "2019-09-30T03:49:18Z")

</div>

If you provide example debug output (in text, not screenshot), people perhaps can help you on your way.

---

<div class="post-metadata">

**Author:** ![Exit2Studios](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/exit2studios/32/10998_2.png) [@Exit2Studios](https://discourse.nodered.org/u/Exit2Studios)\
**Post date:** [30 September 2019 04:50 UTC](https://discourse.nodered.org/t/twitter-parsing/16071/3 "2019-09-30T04:50:12Z")

</div>

Here is an example...all I want is the "31" 🙂 I think if I could pull the number between "Alabama" and the dash, I would be okay:

> Just get it to DeVonta & he'll do the rest! He takes the 23-yard screen pass for his career-best third touchdown of the game!! Alabama 31 – Ole Miss 10 #BamaFactor #RollTide

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [30 September 2019 06:08 UTC](https://discourse.nodered.org/t/twitter-parsing/16071/4 "2019-09-30T06:08:39Z")

</div>

Try searching for Natural Language Processing (nlp) contrib nodes. In this specific tweet you could do a substring starting at Alabama, then split on the dash, keeping the first part, followed by stripping off Alabama. Or a specific regex. However the minute the tweet itself is different that won’t work. So you need a setup capable of extracting data out of natural language. I’ve done this in Python with both NLTK and Spacy, but it’s acting a research topic of its own, rather than something that sounds simple to do 🙂

---

<div class="post-metadata">

**Author:** ![Exit2Studios](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/exit2studios/32/10998_2.png) [@Exit2Studios](https://discourse.nodered.org/u/Exit2Studios)\
**Post date:** [30 September 2019 22:28 UTC](https://discourse.nodered.org/t/twitter-parsing/16071/5 "2019-09-30T22:28:43Z")

</div>

This sounds very interesting. I wasn't able to find any Natural Language nodes...can you point me to the correct one?

---

<div class="post-metadata">

**Author:** ![afelix](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/afelix/32/9743_2.png) [@afelix](https://discourse.nodered.org/u/afelix)\
**Post date:** [1 October 2019 05:48 UTC](https://discourse.nodered.org/t/twitter-parsing/16071/6 "2019-10-01T05:48:57Z")

</div>

I can’t say I’ve done this in node-red or even JavaScript before, but looking at what is available in JS nlp-js looks promising. There’s a contrib node around it, but I haven’t checked out what it exposes.  
If you’d like to learn about the topic in general, the NLTK library in Python wrote a book about it (published at O’Reilly but available for free online under a creative commons license), aimed at using nltk with python, but teaching a lot about nlp and nlp strategies in general: [https://www.nltk.org/book/](https://www.nltk.org/book/)

---

<div class="post-metadata">

**Author:** ![Exit2Studios](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/exit2studios/32/10998_2.png) [@Exit2Studios](https://discourse.nodered.org/u/Exit2Studios)\
**Post date:** [3 October 2019 13:15 UTC](https://discourse.nodered.org/t/twitter-parsing/16071/7 "2019-10-03T13:15:55Z")

</div>

Again, sounds very interesting, but I'm afraid a little over my head from a programming perspective. I was really hoping to repurpose someone else's good work lol.
