Difference between expanded URL and URL seen on Twitter.com



Hi Guys,

Today I encountered a problem I can’t solve. I fetch tweets via https://api.twitter.com/1.1/search/tweets.json?q=mykeyword&result_type=recent&count=100&include_entities=true&lang=nl.

One of the tweets returned is :

“created_at”: “Tue Sep 20 17:48:02 +0000 2016”,
“id”: 778289631116812288,
“id_str”: “778289631116812288”,
“text”: “Ergonomietips voor thuiswerken Dank om te delen ergonomievereniging VerV In filmpje praktische tips\u2026 https://t.co/pTj4Sv2FHj”,
“truncated”: true,
“entities”: {
“hashtags”: [],
“symbols”: [],
“user_mentions”: [],
“urls”: [{
“url”: “https://t.co/pTj4Sv2FHj”,
“expanded_url”: “https://twitter.com/i/web/status/778289631116812288”,
“display_url”: “twitter.com/i/web/status/7\u2026”,
“indices”: [101, 124]

You can see the expanded URL in this example is “https://twitter.com/i/web/status/778289631116812288”, which it is different to the URL when you visit Twitter.com :

Is this a bug, or is there another explanation why this is?




You need to change your API call to https://api.twitter.com/1.1/search/tweets.json?q=mykeyword&result_type=recent&count=100&include_entities=true&lang=nl&tweet_mode=extended

to use the extended tweet format (but you’ll need to update your API parsing to cope with the extended tweet objects


Hi Richard,

Thank you so much for your quick & clear response!

Kind regards,