From 9528315bbb33842e0bb9b7035f9703e6e7b5d000 Mon Sep 17 00:00:00 2001 From: "Juan F. Codagnone" Date: Tue, 3 Mar 2015 11:28:01 -0300 Subject: [PATCH] video support --- .../gnip4j/api/model/Activity.java | 10 + .../gnip4j/api/model/MediaUrls.java | 36 +- .../gnip4j/api/model/TwitterVideoVariant.java | 50 +++ .../zaubersoftware/gnip4j/api/model/Urls.java | 11 +- .../gnip4j/api/model/VideoInfo.java | 54 +++ .../gnip4j/http/JSONDeserializationTest.java | 59 +++ .../gnip4j/payload/animated_gif.js | 383 ++++++++++++++++++ .../zaubersoftware/gnip4j/payload/video.js | 365 +++++++++++++++++ .../zaubersoftware/gnip4j/server/Main.java | 2 +- 9 files changed, 963 insertions(+), 7 deletions(-) create mode 100644 core/src/main/java/com/zaubersoftware/gnip4j/api/model/TwitterVideoVariant.java create mode 100644 core/src/main/java/com/zaubersoftware/gnip4j/api/model/VideoInfo.java create mode 100644 core/src/test/resources/com/zaubersoftware/gnip4j/payload/animated_gif.js create mode 100644 core/src/test/resources/com/zaubersoftware/gnip4j/payload/video.js diff --git a/core/src/main/java/com/zaubersoftware/gnip4j/api/model/Activity.java b/core/src/main/java/com/zaubersoftware/gnip4j/api/model/Activity.java index d0850bae..d9df6aa3 100644 --- a/core/src/main/java/com/zaubersoftware/gnip4j/api/model/Activity.java +++ b/core/src/main/java/com/zaubersoftware/gnip4j/api/model/Activity.java @@ -38,6 +38,8 @@ public class Activity implements Serializable { private Provider provider; @JsonProperty(value = "twitter_entities") private TwitterEntities twitterEntities; + @JsonProperty(value = "twitter_extended_entities") + private TwitterEntities twitterExtendedEntities; private long retweetCount; private int favoritesCount; @JsonProperty(value = "twitter_filter_level") @@ -128,6 +130,14 @@ public final void setTwitterEntities(final TwitterEntities value) { twitterEntities = value; } + public TwitterEntities getTwitterExtendedEntities() { + return twitterExtendedEntities; + } + + public void setTwitterExtendedEntities(final TwitterEntities twitterExtendedEntities) { + this.twitterExtendedEntities = twitterExtendedEntities; + } + public final Gnip getGnip() { if(gnip == null) { gnip = new Gnip(); diff --git a/core/src/main/java/com/zaubersoftware/gnip4j/api/model/MediaUrls.java b/core/src/main/java/com/zaubersoftware/gnip4j/api/model/MediaUrls.java index eb37f6f8..522d8ef5 100644 --- a/core/src/main/java/com/zaubersoftware/gnip4j/api/model/MediaUrls.java +++ b/core/src/main/java/com/zaubersoftware/gnip4j/api/model/MediaUrls.java @@ -27,12 +27,17 @@ public class MediaUrls extends Urls { @JsonProperty(value = "id_str") private String id; + @JsonProperty(value = "source_status_id_str") + private String sourceStatusIdStr; + @JsonProperty(value = "media_url") private String mediaUrl; @JsonProperty("media_url_https") private String mediaUrlHttps; private String type; private Sizes sizes; + @JsonProperty(value = "video_info") + private VideoInfo videoInfo; public String getId() { return id; @@ -70,6 +75,35 @@ public void setSizes(Sizes sizes) { this.sizes = sizes; } - + public String getSourceStatusIdStr() { + return sourceStatusIdStr; + } + + public void setSourceStatusIdStr(final String sourceStatusIdStr) { + this.sourceStatusIdStr = sourceStatusIdStr; + } + + public VideoInfo getVideoInfo() { + return videoInfo; + } + + public void setVideoInfo(final VideoInfo videoInfo) { + this.videoInfo = videoInfo; + } + + public String getMediaUrl() { + return mediaUrl; + } + + public void setMediaUrl(final String mediaUrl) { + this.mediaUrl = mediaUrl; + } + public String getMediaUrlHttps() { + return mediaUrlHttps; + } + + public void setMediaUrlHttps(final String mediaUrlHttps) { + this.mediaUrlHttps = mediaUrlHttps; + } } diff --git a/core/src/main/java/com/zaubersoftware/gnip4j/api/model/TwitterVideoVariant.java b/core/src/main/java/com/zaubersoftware/gnip4j/api/model/TwitterVideoVariant.java new file mode 100644 index 00000000..2e02ac36 --- /dev/null +++ b/core/src/main/java/com/zaubersoftware/gnip4j/api/model/TwitterVideoVariant.java @@ -0,0 +1,50 @@ +/** + * Copyright (c) 2011-2012 Zauber S.A. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.zaubersoftware.gnip4j.api.model; + +import org.codehaus.jackson.annotate.JsonProperty; + +public class TwitterVideoVariant { + private Integer bitrate; + @JsonProperty(value = "content_type") + private String contentType; + private String url; + + public Integer getBitrate() { + return bitrate; + } + + public String getContentType() { + return contentType; + } + + public String getUrl() { + return url; + } + + public void setBitrate(Integer bitrate) { + this.bitrate = bitrate; + } + + public void setContentType(String contentType) { + this.contentType = contentType; + } + + public void setUrl(String url) { + this.url = url; + } + +} diff --git a/core/src/main/java/com/zaubersoftware/gnip4j/api/model/Urls.java b/core/src/main/java/com/zaubersoftware/gnip4j/api/model/Urls.java index 30435894..9e76656e 100644 --- a/core/src/main/java/com/zaubersoftware/gnip4j/api/model/Urls.java +++ b/core/src/main/java/com/zaubersoftware/gnip4j/api/model/Urls.java @@ -122,13 +122,14 @@ public void setUrl(final String value) { public String getDisplayUrl() { return displayUrl; } - /** - * Sets the displayUrl. - * - * @param displayUrl String with the displayUrl. - */ + public void setDisplayUrl(final String displayUrl) { this.displayUrl = displayUrl; } + + public void setIndices(List indices) { + this.indices = indices; + } + } diff --git a/core/src/main/java/com/zaubersoftware/gnip4j/api/model/VideoInfo.java b/core/src/main/java/com/zaubersoftware/gnip4j/api/model/VideoInfo.java new file mode 100644 index 00000000..67467d37 --- /dev/null +++ b/core/src/main/java/com/zaubersoftware/gnip4j/api/model/VideoInfo.java @@ -0,0 +1,54 @@ +/** + * Copyright (c) 2011-2012 Zauber S.A. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.zaubersoftware.gnip4j.api.model; + +import java.util.List; + +import org.codehaus.jackson.annotate.JsonProperty; + +/** + * Twitter Video Info + * + * + * @author Juan F. Codagnone + * @since Mar 3, 2015 + */ +public class VideoInfo { + @JsonProperty(value = "duration_millis") + private Long durationMillis; + private List variants; + @JsonProperty(value = "aspect_ratio") + private List aspectRatio; + public Long getDurationMillis() { + return durationMillis; + } + public void setDurationMillis(final Long durationMillis) { + this.durationMillis = durationMillis; + } + + public List getVariants() { + return variants; + } + public void setVariants(final List variants) { + this.variants = variants; + } + public List getAspectRatio() { + return aspectRatio; + } + public void setAspectRatio(final List aspectRatio) { + this.aspectRatio = aspectRatio; + } +} diff --git a/core/src/test/java/com/zaubersoftware/gnip4j/http/JSONDeserializationTest.java b/core/src/test/java/com/zaubersoftware/gnip4j/http/JSONDeserializationTest.java index adc36eef..0f5b4841 100644 --- a/core/src/test/java/com/zaubersoftware/gnip4j/http/JSONDeserializationTest.java +++ b/core/src/test/java/com/zaubersoftware/gnip4j/http/JSONDeserializationTest.java @@ -23,6 +23,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.ObjectOutputStream; +import java.util.Arrays; import java.util.List; import org.codehaus.jackson.JsonParseException; @@ -36,7 +37,10 @@ import com.zaubersoftware.gnip4j.api.model.Activity; import com.zaubersoftware.gnip4j.api.model.Geo; import com.zaubersoftware.gnip4j.api.model.MatchingRules; +import com.zaubersoftware.gnip4j.api.model.MediaUrls; import com.zaubersoftware.gnip4j.api.model.Point; +import com.zaubersoftware.gnip4j.api.model.TwitterVideoVariant; +import com.zaubersoftware.gnip4j.api.model.VideoInfo; /** @@ -182,4 +186,59 @@ public void testFavoriteCountMissing() throws Exception { is.close(); } } + + /** test a complete unmarshal from the json */ + @Test + public void testAnimatedGif() throws Exception { + final InputStream is = getClass().getClassLoader().getResourceAsStream( + "com/zaubersoftware/gnip4j/payload/animated_gif.js"); + try { + final JsonParser parser = mapper.getJsonFactory().createJsonParser(is); + final Activity activity = parser.readValueAs(Activity.class); + + assertNotNull(activity.getTwitterExtendedEntities()); + assertNotNull(activity.getTwitterExtendedEntities()); + assertEquals(1, activity.getTwitterExtendedEntities().getMediaUrls().size()); + MediaUrls mediaUrls = activity.getTwitterExtendedEntities().getMediaUrls().get(0); + + final VideoInfo videoInfo = mediaUrls.getVideoInfo(); + assertNull(videoInfo.getDurationMillis()); + assertEquals(Arrays.asList(25, 14), videoInfo.getAspectRatio()); + assertEquals(1, videoInfo.getVariants().size()); + final TwitterVideoVariant v = videoInfo.getVariants().get(0); + assertEquals(0, v.getBitrate().intValue()); + assertEquals("video/mp4" , v.getContentType()); + assertEquals("https://pbs.twimg.com/tweet_video/B-vFBELWoAE224Z.mp4" , v.getUrl()); + } finally { + is.close(); + } + } + + /** test a complete unmarshal from the json */ + @Test + public void testVideo() throws Exception { + final InputStream is = getClass().getClassLoader().getResourceAsStream( + "com/zaubersoftware/gnip4j/payload/video.js"); + try { + final JsonParser parser = mapper.getJsonFactory().createJsonParser(is); + final Activity activity = parser.readValueAs(Activity.class); + + assertNotNull(activity.getTwitterExtendedEntities()); + assertNotNull(activity.getTwitterExtendedEntities()); + assertEquals(1, activity.getTwitterExtendedEntities().getMediaUrls().size()); + MediaUrls mediaUrls = activity.getTwitterExtendedEntities().getMediaUrls().get(0); + + final VideoInfo videoInfo = mediaUrls.getVideoInfo(); + assertEquals(29520L, videoInfo.getDurationMillis().longValue()); + assertEquals(Arrays.asList(3, 4), videoInfo.getAspectRatio()); + assertEquals(4, videoInfo.getVariants().size()); + final TwitterVideoVariant v = videoInfo.getVariants().get(0); + assertEquals(320000, v.getBitrate().intValue()); + assertEquals("video/mp4" , v.getContentType()); + assertEquals("https://video.twimg.com/ext_tw_video/570781977240080385/pu/vid/240x320/ukdop381TJHydDNj.mp4" , v.getUrl()); + } finally { + is.close(); + } + } + } diff --git a/core/src/test/resources/com/zaubersoftware/gnip4j/payload/animated_gif.js b/core/src/test/resources/com/zaubersoftware/gnip4j/payload/animated_gif.js new file mode 100644 index 00000000..7d238107 --- /dev/null +++ b/core/src/test/resources/com/zaubersoftware/gnip4j/payload/animated_gif.js @@ -0,0 +1,383 @@ +{ + "gnip": { + "profileLocations": [ + { + "displayName": "Buenos Aires, Buenos Aires F.D., Argentina", + "address": { + "region": "Buenos Aires F.D.", + "locality": "Buenos Aires", + "countryCode": "AR", + "country": "Argentina" + }, + "geo": { + "coordinates": [ + -58.37723, + -34.61315 + ], + "type": "point" + }, + "objectType": "place" + } + ], + "language": { + "value": "es" + }, + "klout_score": 15, + "urls": [ + { + "expanded_status": 200, + "expanded_url": "http://twitter.com/LarryBraveryy/status/570766401251778560/photo/1", + "url": "http://t.co/GI2SiQgYJL" + } + ], + "matching_rules": [ + { + "tag": null + } + ] + }, + "link": "http://twitter.com/JuanTrino1980/statuses/572750675622428672", + "provider": { + "link": "http://www.twitter.com", + "displayName": "Twitter", + "objectType": "service" + }, + "generator": { + "link": "http://twitter.com", + "displayName": "Twitter Web Client" + }, + "postedTime": "2015-03-03T13:29:36.000Z", + "verb": "share", + "actor": { + "favoritesCount": 0, + "location": { + "displayName": "Buenos Aires, Argentina", + "objectType": "place" + }, + "languages": [ + "en" + ], + "links": [ + { + "rel": "me", + "href": null + } + ], + "summary": null, + "image": "https://pbs.twimg.com/profile_images/496283495279247360/BIw_Q1fP_normal.jpeg", + "postedTime": "2014-08-04T13:13:37.000Z", + "displayName": "Juan trino", + "link": "http://www.twitter.com/JuanTrino1980", + "id": "id:twitter.com:2706522510", + "objectType": "person", + "friendsCount": 2, + "followersCount": 2, + "listedCount": 0, + "statusesCount": 52, + "twitterTimeZone": "Buenos Aires", + "verified": false, + "utcOffset": "-10800", + "preferredUsername": "JuanTrino1980" + }, + "objectType": "activity", + "id": "tag:search.twitter.com,2005:572750675622428672", + "body": "RT @FernieDelga: \"@ZAYNXXXL0UIS: Mama me voy tatuar este gif en la frente no es una pregunta es un hecho\nhttp://t.co/GI2SiQgYJL\"", + "object": { + "twitter_lang": "es", + "twitter_filter_level": "low", + "twitter_extended_entities": { + "media": [ + { + "video_info": { + "variants": [ + { + "url": "https://pbs.twimg.com/tweet_video/B-vFBELWoAE224Z.mp4", + "content_type": "video/mp4", + "bitrate": 0 + } + ], + "aspect_ratio": [ + 25, + 14 + ] + }, + "source_status_id_str": "570766401251778560", + "source_status_id": 570766401251778560, + "sizes": { + "medium": { + "resize": "fit", + "h": 280, + "w": 499 + }, + "large": { + "resize": "fit", + "h": 280, + "w": 499 + }, + "small": { + "resize": "fit", + "h": 190, + "w": 340 + }, + "thumb": { + "resize": "crop", + "h": 150, + "w": 150 + } + }, + "type": "animated_gif", + "id": 570766399884402700, + "id_str": "570766399884402689", + "indices": [ + 88, + 110 + ], + "media_url": "http://pbs.twimg.com/tweet_video_thumb/B-vFBELWoAE224Z.png", + "media_url_https": "https://pbs.twimg.com/tweet_video_thumb/B-vFBELWoAE224Z.png", + "url": "http://t.co/GI2SiQgYJL", + "display_url": "pic.twitter.com/GI2SiQgYJL", + "expanded_url": "http://twitter.com/LarryBraveryy/status/570766401251778560/photo/1" + } + ] + }, + "twitter_entities": { + "media": [ + { + "source_status_id_str": "570766401251778560", + "source_status_id": 570766401251778560, + "sizes": { + "medium": { + "resize": "fit", + "h": 280, + "w": 499 + }, + "large": { + "resize": "fit", + "h": 280, + "w": 499 + }, + "small": { + "resize": "fit", + "h": 190, + "w": 340 + }, + "thumb": { + "resize": "crop", + "h": 150, + "w": 150 + } + }, + "type": "photo", + "id": 570766399884402700, + "id_str": "570766399884402689", + "indices": [ + 88, + 110 + ], + "media_url": "http://pbs.twimg.com/tweet_video_thumb/B-vFBELWoAE224Z.png", + "media_url_https": "https://pbs.twimg.com/tweet_video_thumb/B-vFBELWoAE224Z.png", + "url": "http://t.co/GI2SiQgYJL", + "display_url": "pic.twitter.com/GI2SiQgYJL", + "expanded_url": "http://twitter.com/LarryBraveryy/status/570766401251778560/photo/1" + } + ], + "symbols": [], + "user_mentions": [ + { + "indices": [ + 1, + 14 + ], + "id_str": "1833856334", + "id": 1833856334, + "name": "no.", + "screen_name": "ZAYNXXXL0UIS" + } + ], + "urls": [], + "trends": [], + "hashtags": [] + }, + "favoritesCount": 0, + "object": { + "postedTime": "2015-02-26T15:21:27.000Z", + "link": "http://twitter.com/FernieDelga/statuses/570966882922201089", + "summary": "\"@ZAYNXXXL0UIS: Mama me voy tatuar este gif en la frente no es una pregunta es un hecho\nhttp://t.co/GI2SiQgYJL\"", + "id": "object:search.twitter.com,2005:570966882922201089", + "objectType": "note" + }, + "body": "\"@ZAYNXXXL0UIS: Mama me voy tatuar este gif en la frente no es una pregunta es un hecho\nhttp://t.co/GI2SiQgYJL\"", + "id": "tag:search.twitter.com,2005:570966882922201089", + "objectType": "activity", + "actor": { + "favoritesCount": 858, + "location": { + "displayName": "Hurlingham", + "objectType": "place" + }, + "languages": [ + "es" + ], + "links": [ + { + "rel": "me", + "href": null + } + ], + "summary": "@CamiSosaTim diosisima ❤ cam me ama Insta: FernieDelgadillo", + "image": "https://pbs.twimg.com/profile_images/571859119633797120/3MDlT92e_normal.jpeg", + "postedTime": "2012-07-31T02:55:20.000Z", + "displayName": "FERNIE", + "link": "http://www.twitter.com/FernieDelga", + "id": "id:twitter.com:727413992", + "objectType": "person", + "friendsCount": 556, + "followersCount": 299, + "listedCount": 0, + "statusesCount": 4071, + "twitterTimeZone": null, + "verified": false, + "utcOffset": null, + "preferredUsername": "FernieDelga" + }, + "verb": "post", + "postedTime": "2015-02-26T15:21:27.000Z", + "generator": { + "link": "http://twitter.com/download/android", + "displayName": "Twitter for Android" + }, + "provider": { + "link": "http://www.twitter.com", + "displayName": "Twitter", + "objectType": "service" + }, + "link": "http://twitter.com/FernieDelga/statuses/570966882922201089" + }, + "favoritesCount": 0, + "twitter_entities": { + "media": [ + { + "source_status_id_str": "570766401251778560", + "source_status_id": 570766401251778560, + "sizes": { + "medium": { + "resize": "fit", + "h": 280, + "w": 499 + }, + "large": { + "resize": "fit", + "h": 280, + "w": 499 + }, + "small": { + "resize": "fit", + "h": 190, + "w": 340 + }, + "thumb": { + "resize": "crop", + "h": 150, + "w": 150 + } + }, + "type": "photo", + "id": 570766399884402700, + "id_str": "570766399884402689", + "indices": [ + 105, + 127 + ], + "media_url": "http://pbs.twimg.com/tweet_video_thumb/B-vFBELWoAE224Z.png", + "media_url_https": "https://pbs.twimg.com/tweet_video_thumb/B-vFBELWoAE224Z.png", + "url": "http://t.co/GI2SiQgYJL", + "display_url": "pic.twitter.com/GI2SiQgYJL", + "expanded_url": "http://twitter.com/LarryBraveryy/status/570766401251778560/photo/1" + } + ], + "symbols": [], + "user_mentions": [ + { + "indices": [ + 3, + 15 + ], + "id_str": "727413992", + "id": 727413992, + "name": "FERNIE", + "screen_name": "FernieDelga" + }, + { + "indices": [ + 18, + 31 + ], + "id_str": "1833856334", + "id": 1833856334, + "name": "no.", + "screen_name": "ZAYNXXXL0UIS" + } + ], + "urls": [], + "trends": [], + "hashtags": [] + }, + "twitter_extended_entities": { + "media": [ + { + "video_info": { + "variants": [ + { + "url": "https://pbs.twimg.com/tweet_video/B-vFBELWoAE224Z.mp4", + "content_type": "video/mp4", + "bitrate": 0 + } + ], + "aspect_ratio": [ + 25, + 14 + ] + }, + "source_status_id_str": "570766401251778560", + "source_status_id": 570766401251778560, + "sizes": { + "medium": { + "resize": "fit", + "h": 280, + "w": 499 + }, + "large": { + "resize": "fit", + "h": 280, + "w": 499 + }, + "small": { + "resize": "fit", + "h": 190, + "w": 340 + }, + "thumb": { + "resize": "crop", + "h": 150, + "w": 150 + } + }, + "type": "animated_gif", + "id": 570766399884402700, + "id_str": "570766399884402689", + "indices": [ + 105, + 127 + ], + "media_url": "http://pbs.twimg.com/tweet_video_thumb/B-vFBELWoAE224Z.png", + "media_url_https": "https://pbs.twimg.com/tweet_video_thumb/B-vFBELWoAE224Z.png", + "url": "http://t.co/GI2SiQgYJL", + "display_url": "pic.twitter.com/GI2SiQgYJL", + "expanded_url": "http://twitter.com/LarryBraveryy/status/570766401251778560/photo/1" + } + ] + }, + "twitter_filter_level": "low", + "twitter_lang": "es", + "retweetCount": 1 +} diff --git a/core/src/test/resources/com/zaubersoftware/gnip4j/payload/video.js b/core/src/test/resources/com/zaubersoftware/gnip4j/payload/video.js new file mode 100644 index 00000000..d215e76a --- /dev/null +++ b/core/src/test/resources/com/zaubersoftware/gnip4j/payload/video.js @@ -0,0 +1,365 @@ +{ + "gnip": { + "language": { + "value": "en" + }, + "klout_score": 44, + "urls": [ + { + "expanded_status": 200, + "expanded_url": "http://twitter.com/dooleyfunny/status/570782345189580800/video/1", + "url": "http://t.co/gYG0XMt9CC" + } + ], + "matching_rules": [ + { + "tag": null + } + ] + }, + "link": "http://twitter.com/unpromised_/statuses/572750614368788480", + "provider": { + "link": "http://www.twitter.com", + "displayName": "Twitter", + "objectType": "service" + }, + "generator": { + "link": "http://twitter.com/download/android", + "displayName": "Twitter for Android" + }, + "postedTime": "2015-03-03T13:29:22.000Z", + "verb": "share", + "actor": { + "favoritesCount": 4608, + "languages": [ + "en" + ], + "links": [ + { + "rel": "me", + "href": null + } + ], + "summary": "W.Carter ❤", + "image": "https://pbs.twimg.com/profile_images/562577011512999936/La9oeEc6_normal.jpeg", + "postedTime": "2011-03-14T22:13:57.000Z", + "displayName": "Chìco ❤", + "link": "http://www.twitter.com/unpromised_", + "id": "id:twitter.com:266230504", + "objectType": "person", + "friendsCount": 930, + "followersCount": 1180, + "listedCount": 2, + "statusesCount": 30651, + "twitterTimeZone": "Atlantic Time (Canada)", + "verified": false, + "utcOffset": "-14400", + "preferredUsername": "unpromised_" + }, + "objectType": "activity", + "id": "tag:search.twitter.com,2005:572750614368788480", + "body": "RT @dooleyfunny: Teachers be like \"the bell don't dismiss you I do\" 😴😴😴 http://t.co/gYG0XMt9CC", + "object": { + "twitter_lang": "en", + "twitter_filter_level": "low", + "twitter_extended_entities": { + "media": [ + { + "video_info": { + "variants": [ + { + "url": "https://video.twimg.com/ext_tw_video/570781977240080385/pu/vid/240x320/ukdop381TJHydDNj.mp4", + "content_type": "video/mp4", + "bitrate": 320000 + }, + { + "url": "https://video.twimg.com/ext_tw_video/570781977240080385/pu/pl/8LSg6HzwJs5jhC6z.m3u8", + "content_type": "application/x-mpegURL" + }, + { + "url": "https://video.twimg.com/ext_tw_video/570781977240080385/pu/vid/480x640/7xyEaX0Hu-fa-Mcd.webm", + "content_type": "video/webm", + "bitrate": 832000 + }, + { + "url": "https://video.twimg.com/ext_tw_video/570781977240080385/pu/vid/480x640/7xyEaX0Hu-fa-Mcd.mp4", + "content_type": "video/mp4", + "bitrate": 832000 + } + ], + "duration_millis": 29520, + "aspect_ratio": [ + 3, + 4 + ] + }, + "sizes": { + "large": { + "resize": "fit", + "h": 640, + "w": 480 + }, + "medium": { + "resize": "fit", + "h": 640, + "w": 480 + }, + "thumb": { + "resize": "crop", + "h": 150, + "w": 150 + }, + "small": { + "resize": "fit", + "h": 453, + "w": 340 + } + }, + "type": "video", + "id": 570781977240080400, + "id_str": "570781977240080385", + "indices": [ + 55, + 77 + ], + "media_url": "http://pbs.twimg.com/ext_tw_video_thumb/570781977240080385/pu/img/8u3REJO-JMV0s0u2.jpg", + "media_url_https": "https://pbs.twimg.com/ext_tw_video_thumb/570781977240080385/pu/img/8u3REJO-JMV0s0u2.jpg", + "url": "http://t.co/gYG0XMt9CC", + "display_url": "pic.twitter.com/gYG0XMt9CC", + "expanded_url": "http://twitter.com/dooleyfunny/status/570782345189580800/video/1" + } + ] + }, + "twitter_entities": { + "media": [ + { + "sizes": { + "large": { + "resize": "fit", + "h": 640, + "w": 480 + }, + "medium": { + "resize": "fit", + "h": 640, + "w": 480 + }, + "thumb": { + "resize": "crop", + "h": 150, + "w": 150 + }, + "small": { + "resize": "fit", + "h": 453, + "w": 340 + } + }, + "type": "photo", + "id": 570781977240080400, + "id_str": "570781977240080385", + "indices": [ + 55, + 77 + ], + "media_url": "http://pbs.twimg.com/ext_tw_video_thumb/570781977240080385/pu/img/8u3REJO-JMV0s0u2.jpg", + "media_url_https": "https://pbs.twimg.com/ext_tw_video_thumb/570781977240080385/pu/img/8u3REJO-JMV0s0u2.jpg", + "url": "http://t.co/gYG0XMt9CC", + "display_url": "pic.twitter.com/gYG0XMt9CC", + "expanded_url": "http://twitter.com/dooleyfunny/status/570782345189580800/video/1" + } + ], + "symbols": [], + "user_mentions": [], + "urls": [], + "trends": [], + "hashtags": [] + }, + "favoritesCount": 16739, + "object": { + "postedTime": "2015-02-26T03:08:10.000Z", + "link": "http://twitter.com/dooleyfunny/statuses/570782345189580800", + "summary": "Teachers be like \"the bell don't dismiss you I do\" 😴😴😴 http://t.co/gYG0XMt9CC", + "id": "object:search.twitter.com,2005:570782345189580800", + "objectType": "note" + }, + "body": "Teachers be like \"the bell don't dismiss you I do\" 😴😴😴 http://t.co/gYG0XMt9CC", + "id": "tag:search.twitter.com,2005:570782345189580800", + "objectType": "activity", + "actor": { + "favoritesCount": 11366, + "location": { + "displayName": "Baltimore MD", + "objectType": "place" + }, + "languages": [ + "en" + ], + "links": [ + { + "rel": "me", + "href": null + } + ], + "summary": "Fear Allah Only #⃣iAmMuslim ❗️97bby Jan 21st ❗️IG/Snapchat/Vine - @dooleyfunny ❗️ #⃣IBN ❗️GO WATCH ALL MY VIDEOS ‼️‼️‼️‼️@dooleyvideos‼️‼️‼️‼️", + "image": "https://pbs.twimg.com/profile_images/559387957443174400/gjZOIOfc_normal.jpeg", + "postedTime": "2011-10-22T20:05:05.000Z", + "displayName": "Dooley®", + "link": "http://www.twitter.com/dooleyfunny", + "id": "id:twitter.com:396132917", + "objectType": "person", + "friendsCount": 2398, + "followersCount": 7464, + "listedCount": 3, + "statusesCount": 21804, + "twitterTimeZone": "Eastern Time (US & Canada)", + "verified": false, + "utcOffset": "-18000", + "preferredUsername": "dooleyfunny" + }, + "verb": "post", + "postedTime": "2015-02-26T03:08:10.000Z", + "generator": { + "link": "http://twitter.com/download/iphone", + "displayName": "Twitter for iPhone" + }, + "provider": { + "link": "http://www.twitter.com", + "displayName": "Twitter", + "objectType": "service" + }, + "link": "http://twitter.com/dooleyfunny/statuses/570782345189580800" + }, + "favoritesCount": 0, + "twitter_entities": { + "media": [ + { + "source_status_id_str": "570782345189580800", + "source_status_id": 570782345189580800, + "sizes": { + "large": { + "resize": "fit", + "h": 640, + "w": 480 + }, + "medium": { + "resize": "fit", + "h": 640, + "w": 480 + }, + "thumb": { + "resize": "crop", + "h": 150, + "w": 150 + }, + "small": { + "resize": "fit", + "h": 453, + "w": 340 + } + }, + "type": "photo", + "id": 570781977240080400, + "id_str": "570781977240080385", + "indices": [ + 72, + 94 + ], + "media_url": "http://pbs.twimg.com/ext_tw_video_thumb/570781977240080385/pu/img/8u3REJO-JMV0s0u2.jpg", + "media_url_https": "https://pbs.twimg.com/ext_tw_video_thumb/570781977240080385/pu/img/8u3REJO-JMV0s0u2.jpg", + "url": "http://t.co/gYG0XMt9CC", + "display_url": "pic.twitter.com/gYG0XMt9CC", + "expanded_url": "http://twitter.com/dooleyfunny/status/570782345189580800/video/1" + } + ], + "symbols": [], + "user_mentions": [ + { + "indices": [ + 3, + 15 + ], + "id_str": "396132917", + "id": 396132917, + "name": "Dooley®", + "screen_name": "dooleyfunny" + } + ], + "urls": [], + "trends": [], + "hashtags": [] + }, + "twitter_extended_entities": { + "media": [ + { + "video_info": { + "variants": [ + { + "url": "https://video.twimg.com/ext_tw_video/570781977240080385/pu/vid/240x320/ukdop381TJHydDNj.mp4", + "content_type": "video/mp4", + "bitrate": 320000 + }, + { + "url": "https://video.twimg.com/ext_tw_video/570781977240080385/pu/pl/8LSg6HzwJs5jhC6z.m3u8", + "content_type": "application/x-mpegURL" + }, + { + "url": "https://video.twimg.com/ext_tw_video/570781977240080385/pu/vid/480x640/7xyEaX0Hu-fa-Mcd.webm", + "content_type": "video/webm", + "bitrate": 832000 + }, + { + "url": "https://video.twimg.com/ext_tw_video/570781977240080385/pu/vid/480x640/7xyEaX0Hu-fa-Mcd.mp4", + "content_type": "video/mp4", + "bitrate": 832000 + } + ], + "duration_millis": 29520, + "aspect_ratio": [ + 3, + 4 + ] + }, + "source_status_id_str": "570782345189580800", + "source_status_id": 570782345189580800, + "sizes": { + "large": { + "resize": "fit", + "h": 640, + "w": 480 + }, + "medium": { + "resize": "fit", + "h": 640, + "w": 480 + }, + "thumb": { + "resize": "crop", + "h": 150, + "w": 150 + }, + "small": { + "resize": "fit", + "h": 453, + "w": 340 + } + }, + "type": "video", + "id": 570781977240080400, + "id_str": "570781977240080385", + "indices": [ + 72, + 94 + ], + "media_url": "http://pbs.twimg.com/ext_tw_video_thumb/570781977240080385/pu/img/8u3REJO-JMV0s0u2.jpg", + "media_url_https": "https://pbs.twimg.com/ext_tw_video_thumb/570781977240080385/pu/img/8u3REJO-JMV0s0u2.jpg", + "url": "http://t.co/gYG0XMt9CC", + "display_url": "pic.twitter.com/gYG0XMt9CC", + "expanded_url": "http://twitter.com/dooleyfunny/status/570782345189580800/video/1" + } + ] + }, + "twitter_filter_level": "low", + "twitter_lang": "en", + "retweetCount": 22035 +} diff --git a/mock-server/src/main/java/com/zaubersoftware/gnip4j/server/Main.java b/mock-server/src/main/java/com/zaubersoftware/gnip4j/server/Main.java index bfd8fcb5..7ec65a88 100644 --- a/mock-server/src/main/java/com/zaubersoftware/gnip4j/server/Main.java +++ b/mock-server/src/main/java/com/zaubersoftware/gnip4j/server/Main.java @@ -26,7 +26,7 @@ public final class Main { private static final int DEFAUL_SERVER_PORT = 8080; private static final InputStream ACTIVITIES = Main.class.getClassLoader().getResourceAsStream( - "com/zaubersoftware/gnip4j/server/activity/unlimitedActivity.json"); + "com/zaubersoftware/gnip4j/server/activity/twitter.json"); public static void main(final String[] args) throws InterruptedException { final MockServer mockServer = new MockServer(DEFAUL_SERVER_PORT);