Why do User Entities have only 'urls' field and not others?


#1

This is what I see on user entities:

{
  "url": {
    "urls": [
      {
        "url": "https://t.co/Y20pnSLaPD",
        "expanded_url": "http://pixiv.me/dptkddud",
        "display_url": "pixiv.me/dptkddud",
        "indices": [
          0,
          23
        ]
      }
    ]
  },
  "description": {
    "urls": [
      {
        "url": "https://t.co/DZqnlf7pbh",
        "expanded_url": "http://privatter.net/u/sugobat",
        "display_url": "privatter.net/u/sugobat",
        "indices": [
          19,
          42
        ]
      }
    ]
  }
}

I would expect ‘description’ field include ‘urls’, ‘hashtags’, ‘mentions’ and so on which are expected on tweet status entities, but this is not the case. What is the reason not to include them when Twitter website in fact use them?


fromJSON deserializing skips 'url' node of every other Twitter user tree. Any ideas?
#2

Great question!

A User object describes an account, with relevant fields. Whilst it is possible to include hashtags and URLs in the description, that’s generally expected to be a text field and so those entities are not split out as part of the User object’s metadata itself. Additionally, some of these entities like hashtags were added to the platform later, so they are not all represented in the User object today.

You could use twitter-text to parse out any recognised entities, but this is not part of the way that the API around User objects is designed at the moment.


#3

Thanks! Is there a plan or any internal discussion to add those additional entities?


#4

No plan and it probably wouldn’t be a high priority right now (since you can parse out the entities as a workaround), but if that changes we’ll certainly announce here. You can also use https://www.apichangelog.com/api/twitter to monitor when things change in our API docs.


#5

I see, thanks.

BTW, one can never get some information e.g. user_ids from text itself and the object structure from twitter-text is fairly different with one from Twitter server. These prevent code reuse, so I hope Twitter soon give full entities via API.


#6