Streaming tweets that stem from a tweet from a certain user


#1

Hi,

I was wondering if there was a method free (or paid) that can stream tweets that have replied to a specific user or is a follow on tweet from the same specific user.

For example, just say the specific user is @realdonaldtrump. I would like to access all the tweets that have followed on from a tweet from @realdonaldtrump.

My aim is to analyse conversation lengths of a specific user rather than a topic (which is how I stream at the moment).

I am able to just sort the data that I stream from entering the search term realdonaldtrump, such that I only use data which stems from the user @realdonaldtrump but I would like to maximise the data points that I can capture through streaming because a lot of tweets replying to @realdonaldtrump won’t have that term in the tweet.

Thanks


#2

You could use the is:reply operator in the enterprise PowerTrack API. This is not available in the standard streaming API.


#3

Thanks Andy.

That is kind of what I’m looking for, however is that referencing the in_reply_to_user_id? If it is, it would only find the first tweet that replied to @realdonaldtrump and all my conversations would be of length 2. Or does this reference “people in conversation” (see pics) that is visible when browsing twitter through the browser or app. From what I could see this information isn’t available in a single tweet and is generated, but I could be wrong and will be happily corrected.


#4

Hi @dshandler - the Tweet payload returns an in_reply_to_status_id field. Taking your example, you could pass a query that would return all Tweets that respond directly to the first Tweet of the thread (the original Tweet). You would get a series of Tweets back, all of which are a direct response to the original Tweet. Example query below (using Historical PowerTrack).

So to answer your first question: with this example query, the number of Tweets returned would be a lot more than 2.

{
    "value":"in_reply_to_status_id:1070110927788347393",
    "tag":"test_1"
 }

However, this example request would not pick up on “sub-conversations”, such as the Tweet you screenshotted.

I’ve pasted below the first part of the Tweet payload that corresponds to the Tweet in your screenshot. You can see that the in_reply_to_status_id field references a different status id: this is the status id that the user was directly responding to here (and not the status id that first started the thread).

If you wanted to know all the “people in conversation”, you can use the user_mentions field to see all people who are included in this response (including the very first user who started the thread).

{
  "created_at": "Wed Dec 05 00:33:51 +0000 2018",
  "id": 1070113988245999616,
  "id_str": "1070113988245999616",
  "full_text": "@jstrong244 @krassenstein @EdKrassen @realDonaldTrump Cant handle the truth mate?",
  "truncated": false,
  "display_text_range": [
    54,
    81
  ],
  "entities": {
    "hashtags": [],
    "symbols": [],
    "user_mentions": [
      {
        "screen_name": "jstrong244",
        "name": "Jasaplay",
        "id": 2868067125,
        "id_str": "2868067125",
        "indices": [
          0,
          11
        ]
      },
      {
        "screen_name": "krassenstein",
        "name": "Brian Krassenstein",
        "id": 133938408,
        "id_str": "133938408",
        "indices": [
          12,
          25
        ]
      },
      {
        "screen_name": "EdKrassen",
        "name": "Ed Krassenstein",
        "id": 132339474,
        "id_str": "132339474",
        "indices": [
          26,
          36
        ]
      },
      {
        "screen_name": "realDonaldTrump",
        "name": "Donald J. Trump",
        "id": 25073877,
        "id_str": "25073877",
        "indices": [
          37,
          53
        ]
      }
    ],
    "urls": []
  },
  "source": "<a href=\"http:\/\/twitter.com\" rel=\"nofollow\">Twitter Web Client<\/a>",
  "in_reply_to_status_id": 1070113599199371265,
  "in_reply_to_status_id_str": "1070113599199371265",
  "in_reply_to_user_id": 2868067125,
  "in_reply_to_user_id_str": "2868067125",
  "in_reply_to_screen_name": "jstrong244",
  "user": {
    "id": 830612821155082241,
    "id_str": "830612821155082241",
    "name": "Vince Smith",
    "screen_name": "TheNutter64",
    "location": "Brisbane, Queensland",
    "description": "",
    "url": null,
    "entities": {
      "description": {
        "urls": []
      }
    },
ETC.