How can I replicate Twitter's display of a tweet?


#1

In some cases, the interaction.content and twitter.text do not match what is displayed by twitter. For example, if the tweet is:
$ORCL - Salesforce.com Marketing Services May Be Q3 Highlight -> stock-news.net/38860 #stock #stocks #ORCL

the ‘Salesforce.com’ will be a link (t.com/…). The interaction that is returned through the API, however, contains the linked url, rather than ‘Salesforce.com’.

a) Is there any way to get the content as Twitter displays it?
b) It there any way to distinguish this type of link from those that are displayed at the links themselves?


#2

Hi,

This is actually how Twitter sends it to us. There is an output target field that (twitter.display_urls) that you can use. 

Here is how the Tweet looks like from Twitter's API:

{

  "lang": "en",

  "possibly_sensitive": false,

  "retweeted": false,

  "favorited": false,

  "entities": {

    "user_mentions": [],

    "urls": [

      {

        "indices": [

          8,

          30

        ],

        "display_url": "Salesforce.com",

        "expanded_url": "http://Salesforce.com",

        "url": "http://t.co/ftpezoFXsF"

      },

      {

        "indices": [

          76,

          98

        ],

        "display_url": "stock-news.net/38860",

        "expanded_url": "http://stock-news.net/38860",

        "url": "http://t.co/riKzxjuau6"

      }

    ],

    "symbols": [

      {

        "indices": [

          0,

          5

        ],

        "text": "ORCL"

      }

    ],

    "hashtags": [

      {

        "indices": [

          99,

          105

        ],

        "text": "stock"

      },

      {

        "indices": [

          106,

          113

        ],

        "text": "stocks"

      },

      {

        "indices": [

          114,

          119

        ],

        "text": "ORCL"

      }

    ]

  },

  "favorite_count": 0,

  "retweet_count": 0,

  "in_reply_to_status_id_str": null,

  "in_reply_to_status_id": null,

  "truncated": false,

  "source": "<a href=\"http://backlinks-kaufen.info\" rel=\"nofollow\">mystock123</a>",

  "text": "$ORCL - http://t.co/ftpezoFXsF Marketing Services May Be Q3 Highlight -&gt; http://t.co/riKzxjuau6 #stock #stocks #ORCL",

  "id_str": "401448229474406401",

  "id": 401448229474406400,

  "created_at": "Fri Nov 15 20:34:51 +0000 2013",

  "in_reply_to_user_id": null,

  "in_reply_to_user_id_str": null,

  "in_reply_to_screen_name": null,

  "user": {

    "notifications": false,

    "follow_request_sent": false,

    "following": false,

    "default_profile_image": false,

    "default_profile": true,

    "profile_use_background_image": true,

    "time_zone": null,

    "utc_offset": null,

    "favourites_count": 0,

    "created_at": "Thu Sep 03 18:15:30 +0000 2009",

    "listed_count": 15,

    "friends_count": 1414,

    "followers_count": 1407,

    "protected": false,

    "id": 71319651,

    "id_str": "71319651",

    "name": "Stock News 24",

    "screen_name": "mrtoxo",

    "location": "",

    "description": "",

    "url": null,

    "entities": {

      "description": {

        "urls": []

      }

    },

    "geo_enabled": false,

    "verified": false,

    "statuses_count": 5621,

    "lang": "en",

    "contributors_enabled": false,

    "is_translator": false,

    "profile_background_color": "C0DEED",

    "profile_background_image_url": "http://abs.twimg.com/images/themes/theme1/bg.png",

    "profile_background_image_url_https": "https://abs.twimg.com/images/themes/theme1/bg.png",

    "profile_background_tile": false,

    "profile_image_url": "http://pbs.twimg.com/profile_images/378800000707876168/9bac4fdd2d20d48db1425c02dc0a335c_normal.png",

    "profile_image_url_https": "https://pbs.twimg.com/profile_images/378800000707876168/9bac4fdd2d20d48db1425c02dc0a335c_normal.png",

    "profile_link_color": "0084B4",

    "profile_sidebar_border_color": "C0DEED",

    "profile_sidebar_fill_color": "DDEEF6",

    "profile_text_color": "333333"

  },

  "geo": null,

  "coordinates": null,

  "place": null,

  "contributors": null

}