From 453cbf2ac33a68a7c00e43c405e253d8d8fae20d Mon Sep 17 00:00:00 2001 From: Abraham Williams <4braham@gmail.com> Date: Fri, 6 Jul 2018 14:03:01 -0500 Subject: [PATCH 1/2] Consolidate rendering of statuses --- index.html | 48 +++----- test/quote.json | 287 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 305 insertions(+), 30 deletions(-) create mode 100644 test/quote.json diff --git a/index.html b/index.html index 9b6cb96..62438ce 100644 --- a/index.html +++ b/index.html @@ -38,39 +38,27 @@ + + diff --git a/test/quote.json b/test/quote.json new file mode 100644 index 0000000..ebf7b5f --- /dev/null +++ b/test/quote.json @@ -0,0 +1,287 @@ +{ + "created_at": "Fri Jul 06 03:01:02 +0000 2018", + "id": 1015068072137379840, + "id_str": "1015068072137379840", + "full_text": "Thread. https://t.co/WIHEHWjy0S", + "truncated": false, + "display_text_range": [ + 0, + 7 + ], + "entities": { + "hashtags": [], + "symbols": [], + "user_mentions": [], + "urls": [ + { + "url": "https://t.co/WIHEHWjy0S", + "expanded_url": "https://twitter.com/BlairBraverman/status/1015049038092046336", + "display_url": "twitter.com/BlairBraverman…", + "indices": [ + 8, + 31 + ] + } + ] + }, + "source": "Twitter Web Client", + "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": { + "id": 9436992, + "id_str": "9436992", + "name": "Abraham Williams", + "screen_name": "abraham", + "location": "Madison, WI", + "description": "Developer and caffeine consumer at @Bendyworks, #WebTechnologies @GoogleDevExpert, international speaker, @GDGMadison organizer, writer of code", + "url": "https://t.co/ck29y8mOBT", + "entities": { + "url": { + "urls": [ + { + "url": "https://t.co/ck29y8mOBT", + "expanded_url": "https://abrah.am/", + "display_url": "abrah.am", + "indices": [ + 0, + 23 + ] + } + ] + }, + "description": { + "urls": [] + } + }, + "protected": false, + "followers_count": 8521, + "friends_count": 557, + "listed_count": 583, + "created_at": "Sun Oct 14 12:50:47 +0000 2007", + "favourites_count": 20632, + "utc_offset": null, + "time_zone": null, + "geo_enabled": false, + "verified": false, + "statuses_count": 46546, + "lang": "en", + "contributors_enabled": false, + "is_translator": false, + "is_translation_enabled": false, + "profile_background_color": "FFFFFF", + "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/897079141719195648/_mvh-QJH_normal.jpg", + "profile_image_url_https": "https://pbs.twimg.com/profile_images/897079141719195648/_mvh-QJH_normal.jpg", + "profile_banner_url": "https://pbs.twimg.com/profile_banners/9436992/1490189391", + "profile_link_color": "2196F3", + "profile_sidebar_border_color": "FFFFFF", + "profile_sidebar_fill_color": "FFFFFF", + "profile_text_color": "454545", + "profile_use_background_image": false, + "has_extended_profile": true, + "default_profile": false, + "default_profile_image": false, + "following": false, + "follow_request_sent": false, + "notifications": false, + "translator_type": "regular" + }, + "geo": null, + "coordinates": null, + "place": null, + "contributors": null, + "is_quote_status": true, + "quoted_status_id": 1015049038092046336, + "quoted_status_id_str": "1015049038092046336", + "quoted_status_permalink": { + "url": "https://t.co/WIHEHWjy0S", + "expanded": "https://twitter.com/BlairBraverman/status/1015049038092046336", + "display": "twitter.com/BlairBraverman…" + }, + "quoted_status": { + "created_at": "Fri Jul 06 01:45:24 +0000 2018", + "id": 1015049038092046336, + "id_str": "1015049038092046336", + "full_text": "Came home to some minor tornado wreckage, so I decided to recruit some of the pups for a clean-up party. https://t.co/FWWeM5icXR", + "truncated": false, + "display_text_range": [ + 0, + 104 + ], + "entities": { + "hashtags": [], + "symbols": [], + "user_mentions": [], + "urls": [], + "media": [ + { + "id": 1015048956336791553, + "id_str": "1015048956336791553", + "indices": [ + 105, + 128 + ], + "media_url": "http://pbs.twimg.com/media/DhYtpdgV4AE8e-5.jpg", + "media_url_https": "https://pbs.twimg.com/media/DhYtpdgV4AE8e-5.jpg", + "url": "https://t.co/FWWeM5icXR", + "display_url": "pic.twitter.com/FWWeM5icXR", + "expanded_url": "https://twitter.com/BlairBraverman/status/1015049038092046336/photo/1", + "type": "photo", + "sizes": { + "large": { + "w": 1024, + "h": 768, + "resize": "fit" + }, + "small": { + "w": 680, + "h": 510, + "resize": "fit" + }, + "thumb": { + "w": 150, + "h": 150, + "resize": "crop" + }, + "medium": { + "w": 1024, + "h": 768, + "resize": "fit" + } + } + } + ] + }, + "extended_entities": { + "media": [ + { + "id": 1015048956336791553, + "id_str": "1015048956336791553", + "indices": [ + 105, + 128 + ], + "media_url": "http://pbs.twimg.com/media/DhYtpdgV4AE8e-5.jpg", + "media_url_https": "https://pbs.twimg.com/media/DhYtpdgV4AE8e-5.jpg", + "url": "https://t.co/FWWeM5icXR", + "display_url": "pic.twitter.com/FWWeM5icXR", + "expanded_url": "https://twitter.com/BlairBraverman/status/1015049038092046336/photo/1", + "type": "photo", + "sizes": { + "large": { + "w": 1024, + "h": 768, + "resize": "fit" + }, + "small": { + "w": 680, + "h": 510, + "resize": "fit" + }, + "thumb": { + "w": 150, + "h": 150, + "resize": "crop" + }, + "medium": { + "w": 1024, + "h": 768, + "resize": "fit" + } + } + } + ] + }, + "source": "Twitter for iPhone", + "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": { + "id": 2271638589, + "id_str": "2271638589", + "name": "Blair Braverman", + "screen_name": "BlairBraverman", + "location": "Mountain, Wisconsin", + "description": "Dogsled racer. Nonfiction writer. Outdoors 30 Under 30. If you like these tweets, you'll love WELCOME TO THE GODDAMN ICE CUBE (@eccobooks).", + "url": "https://t.co/fLySNcsj3J", + "entities": { + "url": { + "urls": [ + { + "url": "https://t.co/fLySNcsj3J", + "expanded_url": "http://www.blairbraverman.com", + "display_url": "blairbraverman.com", + "indices": [ + 0, + 23 + ] + } + ] + }, + "description": { + "urls": [] + } + }, + "protected": false, + "followers_count": 21391, + "friends_count": 1017, + "listed_count": 191, + "created_at": "Thu Jan 09 21:29:19 +0000 2014", + "favourites_count": 55650, + "utc_offset": null, + "time_zone": null, + "geo_enabled": true, + "verified": true, + "statuses_count": 32490, + "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/965629252627550211/fC80e9zn_normal.jpg", + "profile_image_url_https": "https://pbs.twimg.com/profile_images/965629252627550211/fC80e9zn_normal.jpg", + "profile_banner_url": "https://pbs.twimg.com/profile_banners/2271638589/1463795235", + "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": true, + "follow_request_sent": false, + "notifications": false, + "translator_type": "none" + }, + "geo": null, + "coordinates": null, + "place": null, + "contributors": null, + "is_quote_status": false, + "retweet_count": 139, + "favorite_count": 716, + "favorited": true, + "retweeted": false, + "possibly_sensitive": false, + "possibly_sensitive_appealable": false, + "lang": "en" + }, + "retweet_count": 0, + "favorite_count": 1, + "favorited": false, + "retweeted": false, + "possibly_sensitive": false, + "possibly_sensitive_appealable": false, + "lang": "en" +} From ee0b8b48b06289c04fae528cbcb2fcaf0db346f2 Mon Sep 17 00:00:00 2001 From: Abraham Williams <4braham@gmail.com> Date: Fri, 6 Jul 2018 14:12:15 -0500 Subject: [PATCH 2/2] Add quoted_status fields to interface --- src/status.ts | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/status.ts b/src/status.ts index 6825c3d..cae3349 100644 --- a/src/status.ts +++ b/src/status.ts @@ -140,12 +140,20 @@ export interface StatusData { geo: null, id_str: string, id: number, - in_reply_to_screen_name: string | null, - in_reply_to_status_id_str: string | null, - in_reply_to_status_id: number | null, - in_reply_to_user_id_str: string | null, - in_reply_to_user_id: number | null, + in_reply_to_screen_name?: string, + in_reply_to_status_id_str?: string, + in_reply_to_status_id?: number, + in_reply_to_user_id_str?: string, + in_reply_to_user_id?: number, is_quote_status: boolean, + quoted_status_id?: number, + quoted_status_id_str?: string, + quoted_status_permalink?: { + url: string, + expanded: string, + display: string, + }, + quoted_status?: StatusData, lang: string, place: null, possibly_sensitive_appealable: boolean,