# Pulling historical data from Twitter API and writing to a CVS file

**URL:** https://discourse.nodered.org/t/pulling-historical-data-from-twitter-api-and-writing-to-a-cvs-file/52167
**Category:** General
**Created:** [13 October 2021 14:54 UTC](https://discourse.nodered.org/t/pulling-historical-data-from-twitter-api-and-writing-to-a-cvs-file/52167 "2021-10-13T14:54:27Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![stanno](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stanno/32/49349_2.png) [@stanno](https://discourse.nodered.org/u/stanno)
#### Post date: [13 October 2021 14:54 UTC](https://discourse.nodered.org/t/pulling-historical-data-from-twitter-api-and-writing-to-a-cvs-file/52167/1 "2021-10-13T14:54:27Z")

</div>

Hello all, I've recently started using nodeRed so naturally, I've run into difficulties and really need some help piecing phase 2 of my project together.

The Standard Track TwitterAPI allows for access to the past 7 days of tweets, so I'd like to create a list of tweets from this past Monday, for example, with the keyword @elonmusk.

The end goal is to call the API in intervals until I have a chronological list of tweets from a 24hr period(if the rate limit becomes an issue, I'll downscale accordingly). Afterward, run the tweet text through the IBM tone analyzer. Lastly, write each tweet, timestamp, and sentiment score to a CVS file.

 ![Screen Shot 2021-10-13 at 5.03.40 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/9/4/9425cda824ab5130948b6781c38f6421abc32aca.png)

I have this configured right now, which provides a JSON object of 10 tweets. My first goal is 1) properly calling the API in intervals and passing the data through my tone analyzer. I already have the analyzer working from the first edition of this project, which did this process in real-time, rather than with historical data.

Specifically, how can I call the incoming data in a chronological manner and parse it to extract the text? I've tried with the function & switch node, but haven't had any luck. This is what the API call provides at the moment:

 ![Screen Shot 2021-10-13 at 5.04.05 PM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/7/6796ff578acd6bc4a2dde79fbc55e82775c33cb9.png)

Any advice or recommendations are really appreciated. Happy to provide additional information as needed.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [12 December 2021 14:55 UTC](https://discourse.nodered.org/t/pulling-historical-data-from-twitter-api-and-writing-to-a-cvs-file/52167/2 "2021-12-12T14:55:25Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
