0

我意识到有时推文中的链接会缩短,这会发生在“ http://t.co/ ...”。问题是,当这种情况发生时,url 永远不会出现在实体中,我需要这些。有谁知道如何获取这些网址?

例子:

{
"created_at": "Fri Sep 06 15:00:59 +0000 2013",
"id": 375997059792650240,
"id_str": "375997059792650240",
"text": "RT @BreakingNews: 2-month-old baby boy in Minneapolis hit by stray bullet Thursday night; in critical condition - @StarTribune http://t.co/…",
"source": "TweetCaster for Android",
"truncated": false,
"in_reply_to_status_id": null,
"in_reply_to_status_id_str": null,
"in_reply_to_user_id": null,
"in_reply_to_user_id_str": null,
"in_reply_to_screen_name": null,
"user": {},
"geo": null,
"coordinates": null,
"place": null,
"contributors": null,
"retweeted_status": {},
"retweet_count": 55,
"favorite_count": 0,
"entities": {
"hashtags": [],
"symbols": [],
"urls": [],
"user_mentions": []
},
"favorited": false,
"retweeted": false,
"lang": "en"
}
4

1 回答 1

0

我相信检索这些的唯一方法是提交 HEAD 请求,即:

curl -s -I https://t.co/........ | grep location

但是当然要使用您选择的 HTTP 库。

于 2013-09-06T15:19:55.323 回答