diff --git a/lib/XRay/Formats/Twitter.php b/lib/XRay/Formats/Twitter.php
index 9be9a42..f4e0dc8 100644
--- a/lib/XRay/Formats/Twitter.php
+++ b/lib/XRay/Formats/Twitter.php
@@ -108,6 +108,13 @@ class Twitter extends Format {
}
}
+ // In-Reply-To
+ if(property_exists($tweet, 'in_reply_to_status_id_str') && $tweet->in_reply_to_status_id_str) {
+ $entry['in-reply-to'] = [
+ 'https://twitter.com/'.$tweet->in_reply_to_screen_name.'/status/'.$tweet->in_reply_to_status_id_str
+ ];
+ }
+
// Don't include the RT'd photo or video in the main object.
// They get included in the reposted object instead.
if(!property_exists($tweet, 'retweeted_status')) {
diff --git a/tests/TwitterTest.php b/tests/TwitterTest.php
index 1814a08..3f904a9 100644
--- a/tests/TwitterTest.php
+++ b/tests/TwitterTest.php
@@ -244,4 +244,18 @@ Feel like I could (maybe) rewrite previous open code to do some of this :)', $da
Woke up this morning feeling compelled to run to Corona… http://tantek.com/2018/049/t3/rainbow-at-sunrise", $data['data']['content']['text']);
}
+ public function testStreamingTweetReply() {
+ list($url, $json) = $this->loadTweet('streaming-tweet-reply');
+ $data = $this->parse(['url' => $url, 'body' => $json]);
+
+ $this->assertEquals('https://twitter.com/anomalily/status/967024586423386112', $data['data']['in-reply-to'][0]);
+ }
+
+ public function testTweetReply() {
+ list($url, $json) = $this->loadTweet('967046438822674432');
+ $data = $this->parse(['url' => $url, 'body' => $json]);
+
+ $this->assertEquals('https://twitter.com/anomalily/status/967024586423386112', $data['data']['in-reply-to'][0]);
+ }
+
}
diff --git a/tests/data/api.twitter.com/967046438822674432.json b/tests/data/api.twitter.com/967046438822674432.json
new file mode 100644
index 0000000..cdc830c
--- /dev/null
+++ b/tests/data/api.twitter.com/967046438822674432.json
@@ -0,0 +1,120 @@
+{
+ "created_at": "Fri Feb 23 14:40:12 +0000 2018",
+ "id": 967046438822674432,
+ "id_str": "967046438822674432",
+ "full_text": "@anomalily @i_stan4u @borrowtheair It’d be SO BORING if they just skated until they did big jumps and there was no artistry.",
+ "truncated": false,
+ "display_text_range": [
+ 35,
+ 124
+ ],
+ "entities": {
+ "hashtags": [
+
+ ],
+ "symbols": [
+
+ ],
+ "user_mentions": [
+ {
+ "screen_name": "anomalily",
+ "name": "Lillian Karabaic (book out 4/17!)",
+ "id": 46416755,
+ "id_str": "46416755",
+ "indices": [
+ 0,
+ 10
+ ]
+ },
+ {
+ "screen_name": "i_stan4u",
+ "name": "iStan",
+ "id": 947754749964591104,
+ "id_str": "947754749964591104",
+ "indices": [
+ 11,
+ 20
+ ]
+ },
+ {
+ "screen_name": "borrowtheair",
+ "name": "to be honest",
+ "id": 932418774384254977,
+ "id_str": "932418774384254977",
+ "indices": [
+ 21,
+ 34
+ ]
+ }
+ ],
+ "urls": [
+
+ ]
+ },
+ "source": "Twitter for iPhone",
+ "in_reply_to_status_id": 967024586423386112,
+ "in_reply_to_status_id_str": "967024586423386112",
+ "in_reply_to_user_id": 46416755,
+ "in_reply_to_user_id_str": "46416755",
+ "in_reply_to_screen_name": "anomalily",
+ "user": {
+ "id": 349298514,
+ "id_str": "349298514",
+ "name": "Maggie Williams",
+ "screen_name": "pdxmaggie",
+ "location": "Portland, OR",
+ "description": "Prodigal daughter returns to Portland to find she's now constantly overdressed for her hometown.",
+ "url": null,
+ "entities": {
+ "description": {
+ "urls": [
+
+ ]
+ }
+ },
+ "protected": false,
+ "followers_count": 441,
+ "friends_count": 309,
+ "listed_count": 18,
+ "created_at": "Fri Aug 05 21:54:05 +0000 2011",
+ "favourites_count": 2761,
+ "utc_offset": -18000,
+ "time_zone": "Eastern Time (US & Canada)",
+ "geo_enabled": true,
+ "verified": false,
+ "statuses_count": 7256,
+ "lang": "en",
+ "contributors_enabled": false,
+ "is_translator": false,
+ "is_translation_enabled": 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/875413860257103872/mz3WUmK3_normal.jpg",
+ "profile_image_url_https": "https://pbs.twimg.com/profile_images/875413860257103872/mz3WUmK3_normal.jpg",
+ "profile_banner_url": "https://pbs.twimg.com/profile_banners/349298514/1449637782",
+ "profile_link_color": "1DA1F2",
+ "profile_sidebar_border_color": "C0DEED",
+ "profile_sidebar_fill_color": "DDEEF6",
+ "profile_text_color": "333333",
+ "profile_use_background_image": true,
+ "has_extended_profile": true,
+ "default_profile": true,
+ "default_profile_image": false,
+ "following": false,
+ "follow_request_sent": false,
+ "notifications": false,
+ "translator_type": "none"
+ },
+ "geo": null,
+ "coordinates": null,
+ "place": null,
+ "contributors": null,
+ "is_quote_status": false,
+ "retweet_count": 0,
+ "favorite_count": 1,
+ "favorited": false,
+ "retweeted": false,
+ "lang": "en"
+}
\ No newline at end of file
diff --git a/tests/data/api.twitter.com/streaming-tweet-reply.json b/tests/data/api.twitter.com/streaming-tweet-reply.json
new file mode 100644
index 0000000..9e2c0e4
--- /dev/null
+++ b/tests/data/api.twitter.com/streaming-tweet-reply.json
@@ -0,0 +1,110 @@
+
+{
+ "created_at": "Fri Feb 23 14:40:12 +0000 2018",
+ "id": 967046438822674432,
+ "id_str": "967046438822674432",
+ "text": "@anomalily @i_stan4u @borrowtheair It\u2019d be SO BORING if they just skated until they did big jumps and there was no artistry.",
+ "display_text_range": [
+ 35,
+ 124
+ ],
+ "source": "Twitter for iPhone",
+ "truncated": false,
+ "in_reply_to_status_id": 967024586423386112,
+ "in_reply_to_status_id_str": "967024586423386112",
+ "in_reply_to_user_id": 46416755,
+ "in_reply_to_user_id_str": "46416755",
+ "in_reply_to_screen_name": "anomalily",
+ "user": {
+ "id": 349298514,
+ "id_str": "349298514",
+ "name": "Maggie Williams",
+ "screen_name": "pdxmaggie",
+ "location": "Portland, OR",
+ "url": null,
+ "description": "Prodigal daughter returns to Portland to find she's now constantly overdressed for her hometown.",
+ "translator_type": "none",
+ "protected": false,
+ "verified": false,
+ "followers_count": 441,
+ "friends_count": 309,
+ "listed_count": 18,
+ "favourites_count": 2758,
+ "statuses_count": 7249,
+ "created_at": "Fri Aug 05 21:54:05 +0000 2011",
+ "utc_offset": -18000,
+ "time_zone": "Eastern Time (US & Canada)",
+ "geo_enabled": true,
+ "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_link_color": "1DA1F2",
+ "profile_sidebar_border_color": "C0DEED",
+ "profile_sidebar_fill_color": "DDEEF6",
+ "profile_text_color": "333333",
+ "profile_use_background_image": true,
+ "profile_image_url": "http://pbs.twimg.com/profile_images/875413860257103872/mz3WUmK3_normal.jpg",
+ "profile_image_url_https": "https://pbs.twimg.com/profile_images/875413860257103872/mz3WUmK3_normal.jpg",
+ "profile_banner_url": "https://pbs.twimg.com/profile_banners/349298514/1449637782",
+ "default_profile": true,
+ "default_profile_image": false,
+ "following": null,
+ "follow_request_sent": null,
+ "notifications": null
+ },
+ "geo": null,
+ "coordinates": null,
+ "place": null,
+ "contributors": null,
+ "is_quote_status": false,
+ "quote_count": 0,
+ "reply_count": 0,
+ "retweet_count": 0,
+ "favorite_count": 0,
+ "entities": {
+ "hashtags": [],
+ "urls": [],
+ "user_mentions": [
+ {
+ "screen_name": "anomalily",
+ "name": "Lillian Karabaic (book out 4/17!)",
+ "id": 46416755,
+ "id_str": "46416755",
+ "indices": [
+ 0,
+ 10
+ ]
+ },
+ {
+ "screen_name": "i_stan4u",
+ "name": "iStan",
+ "id": 947754749964591104,
+ "id_str": "947754749964591104",
+ "indices": [
+ 11,
+ 20
+ ]
+ },
+ {
+ "screen_name": "borrowtheair",
+ "name": "to be honest",
+ "id": 932418774384254977,
+ "id_str": "932418774384254977",
+ "indices": [
+ 21,
+ 34
+ ]
+ }
+ ],
+ "symbols": []
+ },
+ "favorited": false,
+ "retweeted": false,
+ "filter_level": "low",
+ "lang": "en",
+ "timestamp_ms": "1519396812526"
+}