- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
这是我使用 search/tweets.api 时得到的响应。
{"statuses":[{"created_at":"Sun Jul 29 01:30:52 +0000 2018","id":1023380303648354304,"id_str":"1023380303648354304","text":"RT @FCFSeleccionCol: #FCFSub21 \n\nSemifinal \n\nEn marcha el juego en el Romelio Martínez!\n\nColombia 0 - Haití 0. ⚽⚽. #ColombiaJuegaEnCasa","truncated":false,"entities":{"hashtags":[{"text":"FCFSub21","indices":[21,30]},{"text":"ColombiaJuegaEnCasa","indices":[115,135]}],"symbols":[],"user_mentions":[{"screen_name":"FCFSeleccionCol","name":"Selección Colombia","id":1117317140,"id_str":"1117317140","indices":[3,19]}],"urls":[]},"metadata":{"iso_language_code":"es","result_type":"recent"},"source":"<a href=\"http:\/\/twitter.com\/download\/android\" rel=\"nofollow\">Twitter for Android<\/a>","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":905605889859743745,"id_str":"905605889859743745","name":"Jesus David💯","screen_name":"ReyDavid420","location":"Barranquilla, Colombia","description":"Barranquillero, actor, compositor, rapero y futbolista.","url":null,"entities":{"description":{"urls":[]}},"protected":false,"followers_count":2,"friends_count":67,"listed_count":0,"created_at":"Thu Sep 07 01:37:24 +0000 2017","favourites_count":593,"utc_offset":null,"time_zone":null,"geo_enabled":false,"verified":false,"statuses_count":770,"lang":"es","contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"F5F8FA","profile_background_image_url":null,"profile_background_image_url_https":null,"profile_background_tile":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/1010626181044072449\/oRCkMA1g_normal.jpg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/1010626181044072449\/oRCkMA1g_normal.jpg","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/905605889859743745\/1504748847","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,"retweeted_status":{"created_at":"Sun Jul 29 00:06:15 +0000 2018","id":1023359010630758400,"id_str":"1023359010630758400","text":"#FCFSub21 \n\nSemifinal \n\nEn marcha el juego en el Romelio Martínez!\n\nColombia 0 - Haití 0. ⚽⚽. #ColombiaJuegaEnCasa","truncated":false,"entities":{"hashtags":[{"text":"FCFSub21","indices":[0,9]},{"text":"ColombiaJuegaEnCasa","indices":[94,114]}],"symbols":[],"user_mentions":[],"urls":[]},"metadata":{"iso_language_code":"es","result_type":"recent"},"source":"<a href=\"http:\/\/twitter.com\" rel=\"nofollow\">Twitter Web Client<\/a>","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":1117317140,"id_str":"1117317140","name":"Selección Colombia","screen_name":"FCFSeleccionCol","location":"","description":"Cuenta Oficial Selecciones Colombia de Fútbol \/ Federación Colombiana de Fútbol. ⚽️🇨🇴","url":"https:\/\/t.co\/bdS4TJcR5h","entities":{"url":{"urls":[{"url":"https:\/\/t.co\/bdS4TJcR5h","expanded_url":"http:\/\/www.fcf.com.co\/","display_url":"fcf.com.co","indices":[0,23]}]},"description":{"urls":[]}},"protected":false,"followers_count":4572748,"friends_count":54,"listed_count":3734,"created_at":"Thu Jan 24 17:29:53 +0000 2013","favourites_count":37,"utc_offset":null,"time_zone":null,"geo_enabled":false,"verified":true,"statuses_count":15083,"lang":"es","contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"F5EC3D","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\/1017800505978957824\/1d1KAGzZ_normal.jpg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/1017800505978957824\/1d1KAGzZ_normal.jpg","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/1117317140\/1531348783","profile_link_color":"0084B4","profile_sidebar_border_color":"FFFFFF","profile_sidebar_fill_color":"DDEEF6","profile_text_color":"333333","profile_use_background_image":true,"has_extended_profile":false,"default_profile":false,"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":13,"favorite_count":71,"favorited":false,"retweeted":false,"lang":"es"},"is_quote_status":false,"retweet_count":13,"favorite_count":0,"favorited":false,"retweeted":false,"lang":"es"},{"created_at":"Sun Jul 29 01:30:50 +0000 2018","id":1023380295473684481,"id_str":"1023380295473684481","text":"RT @radafil_diaz: Señores Haiti le gana a Colombian en los Juegos Centro Americano y del Caribe, bien por nuestro vecino mientra @fedofutbo…","truncated":false,"entities":{"hashtags":[],"symbols":[],"user_mentions":[{"screen_name":"radafil_diaz","name":"Radafil Diaz","id":816700741339516930,"id_str":"816700741339516930","indices":[3,16]}],"urls":[]},"metadata":{"iso_language_code":"es","result_type":"recent"},"source":"<a href=\"http:\/\/twitter.com\/download\/android\" rel=\"nofollow\">Twitter for Android<\/a>","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":706612947,"id_str":"706612947","name":"Miguel Gil","screen_name":"mgil047","location":"La Vega, Dominican Republic","description":"Lic. Adm de empresas, Tec. Informático, amante del fútbol, cronista transmisión del atlético vega real, \nsiempre se puede mejorar","url":null,"entities":{"description":{"urls":[]}},"protected":false,"followers_count":342,"friends_count":556,"listed_count":5,"created_at":"Wed Oct 09 16:31:19 +0000 2013","favourites_count":1201,"utc_offset":null,"time_zone":null,"geo_enabled":true,"verified":false,"statuses_count":3015,"lang":"es","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\/998583089893818369\/Ape7HNbM_normal.jpg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/998583089893818369\/Ape7HNbM_normal.jpg","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/706612947\/1425593955","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,"retweeted_status":{"created_at":"Sun Jul 29 01:29:27 +0000 2018","id":1023379945064681472,"id_str":"1023379945064681472","text":"Señores Haiti le gana a Colombian en los Juegos Centro Americano y del Caribe, bien por nuestro vecino mientra… https:\/\/t.co\/p7Z4xNKEIO","truncated":true,"entities":{"hashtags":[],"symbols":[],"user_mentions":[],"urls":[{"url":"https:\/\/t.co\/p7Z4xNKEIO","expanded_url":"https:\/\/twitter.com\/i\/web\/status\/1023379945064681472","display_url":"twitter.com\/i\/web\/status\/1…","indices":[112,135]}]},"metadata":{"iso_language_code":"es","result_type":"recent"},"source":"<a href=\"http:\/\/twitter.com\/download\/android\" rel=\"nofollow\">Twitter for Android<\/a>","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":816700741339516930,"id_str":"816700741339516930","name":"Radafil Diaz","screen_name":"radafil_diaz","location":"Vivo en Panama, Dominicano de ","description":"Amante del deportes dominicano, Beseball,Basqueball, y mi pacion por el futbol, no tiene limite, Amante enamorado Del Barcelona FC, y Atleticos Vega Real!!","url":null,"entities":{"description":{"urls":[]}},"protected":false,"followers_count":374,"friends_count":635,"listed_count":3,"created_at":"Wed Jan 04 17:40:05 +0000 2017","favourites_count":86379,"utc_offset":null,"time_zone":null,"geo_enabled":false,"verified":false,"statuses_count":27444,"lang":"es","contributors_enabled":false,"is_translator":false,"is_translation_enabled":false,"profile_background_color":"F5F8FA","profile_background_image_url":null,"profile_background_image_url_https":null,"profile_background_tile":false,"profile_image_url":"http:\/\/pbs.twimg.com\/profile_images\/1015056769138257923\/YIMDdGlX_normal.jpg","profile_image_url_https":"https:\/\/pbs.twimg.com\/profile_images\/1015056769138257923\/YIMDdGlX_normal.jpg","profile_banner_url":"https:\/\/pbs.twimg.com\/profile_banners\/816700741339516930\/1531107483","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":false,"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":1,"favorite_count":1,"favorited":false,"retweeted":false,"lang":"es"},"is_quote_status":false,"retweet_count":1,"favorite_count":0,"favorited":false,"retweeted":false,"lang":"es"}],"search_metadata":{"completed_in":0.042,"max_id":1023380303648354304,"max_id_str":"1023380303648354304","next_results":"?max_id=1023380295473684480&q=Haiti&count=2&include_entities=1","query":"Haiti","refresh_url":"?since_id=1023380303648354304&q=Haiti&include_entities=1","count":2,"since_id":0,"since_id_str":"0"}}
我无法解析它以获取状态值(created_at、名称、文本等)
这个方法我试过了,没用
public void addItems(JSONArray response){
for (int i = 0; i < response.length(); i++ ) {
//convert each object to a Tweet model
//add that twiit model to our data source
//notify the adapter that we've added an item
try {
Tweet tweet = Tweet.fromJSON(response.getJSONObject(i));
tweets.add(tweet);
tweetAdapter.notifyItemInserted(tweets.size() - 1);
} catch (JSONException e){
e.printStackTrace();
}
}
}
这是 fromJSON 方法:
//deserialize the JSON
public static Tweet fromJSON(JSONObject jsonObject) throws JSONException{
Tweet tweet = new Tweet();
//extract the values from JSON
tweet.body = jsonObject.getString("text");
tweet.uid = jsonObject.getLong("id");
tweet.createdAt = jsonObject.getString("created_at");
tweet.user = User.fromJSON(jsonObject.getJSONObject("user"));
//tweet.extendedEntities = ExtendedEntities.fromJSON
return tweet;
最佳答案
查看此示例如何解析 json && 获取数据。
String str = "{\"statuses\":[{\"created_at\":\"Sun Jul 29 01:30:52 +0000 2018\",\"id\":1023380303648354304,\"id_str\":\"1023380303648354304\",\"text\":\"RT @FCFSeleccionCol: #FCFSub21 \\n\\nSemifinal \\n\\nEn marcha el juego en el Romelio Martínez!\\n\\nColombia 0 - Haití 0. ⚽⚽. #ColombiaJuegaEnCasa\",\"truncated\":false,\"entities\":{\"hashtags\":[{\"text\":\"FCFSub21\",\"indices\":[21,30]},{\"text\":\"ColombiaJuegaEnCasa\",\"indices\":[115,135]}],\"symbols\":[],\"user_mentions\":[{\"screen_name\":\"FCFSeleccionCol\",\"name\":\"Selección Colombia\",\"id\":1117317140,\"id_str\":\"1117317140\",\"indices\":[3,19]}],\"urls\":[]},\"metadata\":{\"iso_language_code\":\"es\",\"result_type\":\"recent\"},\"source\":\"<a href=\\\"http:\\/\\/twitter.com\\/download\\/android\\\" rel=\\\"nofollow\\\">Twitter for Android<\\/a>\",\"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\":905605889859743745,\"id_str\":\"905605889859743745\",\"name\":\"Jesus David\uD83D\uDCAF\",\"screen_name\":\"ReyDavid420\",\"location\":\"Barranquilla, Colombia\",\"description\":\"Barranquillero, actor, compositor, rapero y futbolista.\",\"url\":null,\"entities\":{\"description\":{\"urls\":[]}},\"protected\":false,\"followers_count\":2,\"friends_count\":67,\"listed_count\":0,\"created_at\":\"Thu Sep 07 01:37:24 +0000 2017\",\"favourites_count\":593,\"utc_offset\":null,\"time_zone\":null,\"geo_enabled\":false,\"verified\":false,\"statuses_count\":770,\"lang\":\"es\",\"contributors_enabled\":false,\"is_translator\":false,\"is_translation_enabled\":false,\"profile_background_color\":\"F5F8FA\",\"profile_background_image_url\":null,\"profile_background_image_url_https\":null,\"profile_background_tile\":false,\"profile_image_url\":\"http:\\/\\/pbs.twimg.com\\/profile_images\\/1010626181044072449\\/oRCkMA1g_normal.jpg\",\"profile_image_url_https\":\"https:\\/\\/pbs.twimg.com\\/profile_images\\/1010626181044072449\\/oRCkMA1g_normal.jpg\",\"profile_banner_url\":\"https:\\/\\/pbs.twimg.com\\/profile_banners\\/905605889859743745\\/1504748847\",\"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,\"retweeted_status\":{\"created_at\":\"Sun Jul 29 00:06:15 +0000 2018\",\"id\":1023359010630758400,\"id_str\":\"1023359010630758400\",\"text\":\"#FCFSub21 \\n\\nSemifinal \\n\\nEn marcha el juego en el Romelio Martínez!\\n\\nColombia 0 - Haití 0. ⚽⚽. #ColombiaJuegaEnCasa\",\"truncated\":false,\"entities\":{\"hashtags\":[{\"text\":\"FCFSub21\",\"indices\":[0,9]},{\"text\":\"ColombiaJuegaEnCasa\",\"indices\":[94,114]}],\"symbols\":[],\"user_mentions\":[],\"urls\":[]},\"metadata\":{\"iso_language_code\":\"es\",\"result_type\":\"recent\"},\"source\":\"<a href=\\\"http:\\/\\/twitter.com\\\" rel=\\\"nofollow\\\">Twitter Web Client<\\/a>\",\"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\":1117317140,\"id_str\":\"1117317140\",\"name\":\"Selección Colombia\",\"screen_name\":\"FCFSeleccionCol\",\"location\":\"\",\"description\":\"Cuenta Oficial Selecciones Colombia de Fútbol \\/ Federación Colombiana de Fútbol. ⚽️\uD83C\uDDE8\uD83C\uDDF4\",\"url\":\"https:\\/\\/t.co\\/bdS4TJcR5h\",\"entities\":{\"url\":{\"urls\":[{\"url\":\"https:\\/\\/t.co\\/bdS4TJcR5h\",\"expanded_url\":\"http:\\/\\/www.fcf.com.co\\/\",\"display_url\":\"fcf.com.co\",\"indices\":[0,23]}]},\"description\":{\"urls\":[]}},\"protected\":false,\"followers_count\":4572748,\"friends_count\":54,\"listed_count\":3734,\"created_at\":\"Thu Jan 24 17:29:53 +0000 2013\",\"favourites_count\":37,\"utc_offset\":null,\"time_zone\":null,\"geo_enabled\":false,\"verified\":true,\"statuses_count\":15083,\"lang\":\"es\",\"contributors_enabled\":false,\"is_translator\":false,\"is_translation_enabled\":false,\"profile_background_color\":\"F5EC3D\",\"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\\/1017800505978957824\\/1d1KAGzZ_normal.jpg\",\"profile_image_url_https\":\"https:\\/\\/pbs.twimg.com\\/profile_images\\/1017800505978957824\\/1d1KAGzZ_normal.jpg\",\"profile_banner_url\":\"https:\\/\\/pbs.twimg.com\\/profile_banners\\/1117317140\\/1531348783\",\"profile_link_color\":\"0084B4\",\"profile_sidebar_border_color\":\"FFFFFF\",\"profile_sidebar_fill_color\":\"DDEEF6\",\"profile_text_color\":\"333333\",\"profile_use_background_image\":true,\"has_extended_profile\":false,\"default_profile\":false,\"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\":13,\"favorite_count\":71,\"favorited\":false,\"retweeted\":false,\"lang\":\"es\"},\"is_quote_status\":false,\"retweet_count\":13,\"favorite_count\":0,\"favorited\":false,\"retweeted\":false,\"lang\":\"es\"},{\"created_at\":\"Sun Jul 29 01:30:50 +0000 2018\",\"id\":1023380295473684481,\"id_str\":\"1023380295473684481\",\"text\":\"RT @radafil_diaz: Señores Haiti le gana a Colombian en los Juegos Centro Americano y del Caribe, bien por nuestro vecino mientra @fedofutbo…\",\"truncated\":false,\"entities\":{\"hashtags\":[],\"symbols\":[],\"user_mentions\":[{\"screen_name\":\"radafil_diaz\",\"name\":\"Radafil Diaz\",\"id\":816700741339516930,\"id_str\":\"816700741339516930\",\"indices\":[3,16]}],\"urls\":[]},\"metadata\":{\"iso_language_code\":\"es\",\"result_type\":\"recent\"},\"source\":\"<a href=\\\"http:\\/\\/twitter.com\\/download\\/android\\\" rel=\\\"nofollow\\\">Twitter for Android<\\/a>\",\"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\":706612947,\"id_str\":\"706612947\",\"name\":\"Miguel Gil\",\"screen_name\":\"mgil047\",\"location\":\"La Vega, Dominican Republic\",\"description\":\"Lic. Adm de empresas, Tec. Informático, amante del fútbol, cronista transmisión del atlético vega real, \\nsiempre se puede mejorar\",\"url\":null,\"entities\":{\"description\":{\"urls\":[]}},\"protected\":false,\"followers_count\":342,\"friends_count\":556,\"listed_count\":5,\"created_at\":\"Wed Oct 09 16:31:19 +0000 2013\",\"favourites_count\":1201,\"utc_offset\":null,\"time_zone\":null,\"geo_enabled\":true,\"verified\":false,\"statuses_count\":3015,\"lang\":\"es\",\"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\\/998583089893818369\\/Ape7HNbM_normal.jpg\",\"profile_image_url_https\":\"https:\\/\\/pbs.twimg.com\\/profile_images\\/998583089893818369\\/Ape7HNbM_normal.jpg\",\"profile_banner_url\":\"https:\\/\\/pbs.twimg.com\\/profile_banners\\/706612947\\/1425593955\",\"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,\"retweeted_status\":{\"created_at\":\"Sun Jul 29 01:29:27 +0000 2018\",\"id\":1023379945064681472,\"id_str\":\"1023379945064681472\",\"text\":\"Señores Haiti le gana a Colombian en los Juegos Centro Americano y del Caribe, bien por nuestro vecino mientra… https:\\/\\/t.co\\/p7Z4xNKEIO\",\"truncated\":true,\"entities\":{\"hashtags\":[],\"symbols\":[],\"user_mentions\":[],\"urls\":[{\"url\":\"https:\\/\\/t.co\\/p7Z4xNKEIO\",\"expanded_url\":\"https:\\/\\/twitter.com\\/i\\/web\\/status\\/1023379945064681472\",\"display_url\":\"twitter.com\\/i\\/web\\/status\\/1…\",\"indices\":[112,135]}]},\"metadata\":{\"iso_language_code\":\"es\",\"result_type\":\"recent\"},\"source\":\"<a href=\\\"http:\\/\\/twitter.com\\/download\\/android\\\" rel=\\\"nofollow\\\">Twitter for Android<\\/a>\",\"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\":816700741339516930,\"id_str\":\"816700741339516930\",\"name\":\"Radafil Diaz\",\"screen_name\":\"radafil_diaz\",\"location\":\"Vivo en Panama, Dominicano de \",\"description\":\"Amante del deportes dominicano, Beseball,Basqueball, y mi pacion por el futbol, no tiene limite, Amante enamorado Del Barcelona FC, y Atleticos Vega Real!!\",\"url\":null,\"entities\":{\"description\":{\"urls\":[]}},\"protected\":false,\"followers_count\":374,\"friends_count\":635,\"listed_count\":3,\"created_at\":\"Wed Jan 04 17:40:05 +0000 2017\",\"favourites_count\":86379,\"utc_offset\":null,\"time_zone\":null,\"geo_enabled\":false,\"verified\":false,\"statuses_count\":27444,\"lang\":\"es\",\"contributors_enabled\":false,\"is_translator\":false,\"is_translation_enabled\":false,\"profile_background_color\":\"F5F8FA\",\"profile_background_image_url\":null,\"profile_background_image_url_https\":null,\"profile_background_tile\":false,\"profile_image_url\":\"http:\\/\\/pbs.twimg.com\\/profile_images\\/1015056769138257923\\/YIMDdGlX_normal.jpg\",\"profile_image_url_https\":\"https:\\/\\/pbs.twimg.com\\/profile_images\\/1015056769138257923\\/YIMDdGlX_normal.jpg\",\"profile_banner_url\":\"https:\\/\\/pbs.twimg.com\\/profile_banners\\/816700741339516930\\/1531107483\",\"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\":false,\"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\":1,\"favorite_count\":1,\"favorited\":false,\"retweeted\":false,\"lang\":\"es\"},\"is_quote_status\":false,\"retweet_count\":1,\"favorite_count\":0,\"favorited\":false,\"retweeted\":false,\"lang\":\"es\"}],\"search_metadata\":{\"completed_in\":0.042,\"max_id\":1023380303648354304,\"max_id_str\":\"1023380303648354304\",\"next_results\":\"?max_id=1023380295473684480&q=Haiti&count=2&include_entities=1\",\"query\":\"Haiti\",\"refresh_url\":\"?since_id=1023380303648354304&q=Haiti&include_entities=1\",\"count\":2,\"since_id\":0,\"since_id_str\":\"0\"}}\n";
JSONObject jsonObject = new JSONObject(str);
JSONArray jsonArray = jsonObject.getJSONArray("statuses");
System.out.println(jsonArray.getJSONObject(0).getString("created_at"));
System.out.println(jsonArray.getJSONObject(0).getString("text"));
关于java - 如何解析这个 JSONObject 以从 twitter 搜索 API 获取数组内的值来获取每条推文(名称、正文)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51576554/
用户使用 oauth 登录我的应用程序,注销我的应用程序后,但 twitter 无法执行,问题是用户 twitter 帐户处于事件状态。 当注销我的应用程序的同时注销 Twitter twitter
我在 Twitter 的文本查询字符串参数方面遇到了一些字符编码问题。 a) http://www.twitter.com/share?url=http://www.example.com&text=
就目前而言,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引起辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the he
我正在尝试执行3-legged authorization来在浏览器中调用Twitter API。该过程首先通过将签名的请求发布到 /oauth/request_token 来获得请求 token (
我正在做一个项目来识别用户是否是 Twitter 中的名人。有什么方法可以检查 Twitter 中的用户是否被验证为名人?我知道名人会在推特个人资料中用蓝色徽章来识别。但是我如何通过 Twitter
我想对推文进行一些挖掘。是否有更具体的推文停用词列表,例如删除“lol”和其他推特笑脸? 最佳答案 我想你应该合并普通的停用词列表,例如 this one或that ,带有特定的首字母缩略词词典,例如
我正在为我的期末项目建立一个网站,用于查找和显示 Twitter 上当前 HitTest 门的主题。有谁知道如何从上周或一天内的大量推文中提取主题?我还想知道如何在 http://tweet3d.co
我可以使用获取所有用户的详细信息 https://api.twitter.com/1/account/verify_credentials.json 但我只想通过使用 api 获取 ID 如何获得它。
我见过多个“允许此应用程序与 twitter 一起运行”的内容,但没有一个: 查看您的 Twitter 密码 在“此应用程序将能够”下 示例: 最佳答案 没有 Twitter 永远不会允许人们看到您的
我注意到最近的一些推文有与之相关的媒体,例如来自 TwitPic 或 Flickr 的照片以及来自 Youtube 的视频。你可以直接在 Twitter 网站上看到它们,所以它不仅仅是一个链接。我的想
在 Twitter API 中,有一个 status_lookup 方法可以“水化”推文。文档不清楚这意味着什么。那么我什么时候需要补充推文呢? 如果我有来自 /statuses/user_timel
我使用以下代码来显示一个带有已填充消息的 Twitter 框的页面: Click me 但是,在页面上,我在 Twitter 框中得到了这个: myMessage/ 注意结尾的斜杠。有什么想法可以解决
关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。 这个问题似乎与 help center 中定义的范围内的编程无关。 . 关闭 7 年前。 Improve
在开发包含 Twitter 客户端的 iOS 应用程序时,我必须允许用户生成主题标签(可以在应用程序内的其他位置创建,而不仅仅是在推文正文中创建)。 我想确保任何此类主题标签对于 Twitter 都有
我是集群新手,之前刚刚实现了一些算法。我需要根据推文的相似性对推文进行聚类。一种方法是仅使用哈希标签,但我认为这不会提供那么多信息。因此应该分析完整的推文。 此外,我还在网上搜索聚类提要的算法。 我遇
我想在 ios 7 中集成 twitter 并希望实现以下功能。1. 从 iOS 应用程序使用 Twitter 登录。2. 获取用户资料信息 我尝试了几个解决方案,但没有一个对我有用。请帮忙。 最佳答
是否有任何方法可以使用用户 ID 或屏幕名称构建个人资料图像 URL?我将用户 ID 存储在数据库中,但我不想存储个人资料图像 url。 编辑: 我也不想进行 api 调用。我想将 user_id 放
在 iOS5 上,是否可以提示用户并将其引导至 Twitter Settings.app 区域,以便他们可以将自己的 Twitter 帐户添加到手机中?如果是,你是怎么做到的? 作为解决方法,我可以指
有许多网站为 Twitter 提供附加服务: hashtags.org tweetmeme.com repeets.com dailyrt.com backtweets.com 他们都有一个共同点:他
我正在使用 Twitter Bootstrap 并尝试使用背景打印页面。 我尝试了网络浏览器中的所有选项,但它不起作用。 如果我不包括 twitter bootstrap,则背景的打印效果很好。 (顺
我是一名优秀的程序员,十分优秀!