gpt4 book ai didi

json - YAJL 流解析和 Twitter 流 API

转载 作者:行者123 更新时间:2023-12-04 06:35:38 26 4
gpt4 key购买 nike

Twitter 流 API 返回 JSON 块,但我的 YAJL 解析器在第一个之后停止。我想这是因为每个 JSON 块都是独立的(即:不在全局数组中),所以 YAJL 无法知道它没有完成。

我该如何处理?这是我通过流获得的样本:

    {"user":{"statuses_count":357,"profile_link_color":"93A644","profile_sidebar_border_color":"eeeeee","followers_count":28,"contributors_enabled":false,"profile_use_background_image":true,"created_at":"Fri Jun 04 22:45:23 +0000 2010","location":"Brazil","verified":false,"profile_background_color":"B2DFDA","follow_request_sent":null,"profile_background_image_url":"http:\/\/a3.twimg.com\/profile_background_images\/201416971\/egito.jpg","description":"Dare to defy the status quo!!! For a free Egypt!","is_translator":false,"favourites_count":14,"time_zone":"Brasilia","profile_text_color":"333333","protected":false,"url":null,"profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/1233185161\/Flag-Pins-Brazil-Egypt_normal.jpg","notifications":null,"profile_sidebar_fill_color":"ffffff","name":"lu costa","id_str":"152038309","listed_count":0,"lang":"en","profile_background_tile":true,"screen_name":"dacostalu","id":152038309,"show_all_inline_media":false,"following":null,"geo_enabled":false,"utc_offset":-10800,"friends_count":35},"coordinates":null,"retweet_count":49,"truncated":false,"text":"RT @arwasm: Protesters are calling for volunteers to be at the entrances to #tahrir. Entrances are more exposed than yesterday. #jan25 # ...","favorited":false,"created_at":"Sat Feb 05 15:13:00 +0000 2011","in_reply_to_user_id":null,"in_reply_to_status_id":null,"source":"web","in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"entities":{"hashtags":[{"indices":[76,83],"text":"tahrir"},{"indices":[128,134],"text":"jan25"}],"user_mentions":[{"indices":[3,10],"name":"Arwa Mahmoud","screen_name":"arwasm","id_str":"63693027","id":63693027}],"urls":[]},"contributors":null,"place":null,"geo":null,"retweeted":false,"in_reply_to_user_id_str":null,"id_str":"33905938754834432","retweeted_status":{"user":{"statuses_count":3057,"profile_link_color":"990000","profile_sidebar_border_color":"DFDFDF","followers_count":1468,"contributors_enabled":false,"profile_use_background_image":true,"created_at":"Fri Aug 07 11:21:27 +0000 2009","location":"Cairo, Egypt","verified":false,"profile_background_color":"EBEBEB","follow_request_sent":null,"profile_background_image_url":"http:\/\/a2.twimg.com\/profile_background_images\/70305782\/even_smaller.jpg","description":"Writer, blogger, mountaineer wannabe. Author of A Battle of Creed & \u0642\u062a\u0627\u0644 \u062d\u0632\u0628 \u0627\u0644\u0644\u0647. Falls head over heals with every mountain she meets!","is_translator":false,"favourites_count":0,"time_zone":"Santiago","profile_text_color":"333333","protected":false,"url":"http:\/\/www.alhurr.com","profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/1233059668\/e296709a-cb86-45fd-aa75-89d3fa8a02ac_normal.png","notifications":null,"profile_sidebar_fill_color":"F3F3F3","name":"Arwa Mahmoud","id_str":"63693027","listed_count":156,"lang":"en","profile_background_tile":true,"screen_name":"arwasm","id":63693027,"show_all_inline_media":false,"following":null,"geo_enabled":false,"utc_offset":-14400,"friends_count":182},"coordinates":null,"retweet_count":49,"truncated":false,"text":"Protesters are calling for volunteers to be at the entrances to #tahrir. Entrances are more exposed than yesterday. #jan25 #egypt","favorited":false,"created_at":"Sat Feb 05 14:40:39 +0000 2011","in_reply_to_user_id":null,"in_reply_to_status_id":null,"source":"\u003Ca href=\"http:\/\/blackberry.com\/twitter\" rel=\"nofollow\"\u003ETwitter for BlackBerry\u00ae\u003C\/a\u003E","in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"entities":{"hashtags":[{"indices":[64,71],"text":"tahrir"},{"indices":[116,122],"text":"jan25"},{"indices":[123,129],"text":"egypt"}],"user_mentions":[],"urls":[]},"contributors":null,"place":null,"geo":null,"retweeted":false,"in_reply_to_user_id_str":null,"id_str":"33897797342199808","id":33897797342199808},"id":33905938754834432}
{"user":{"follow_request_sent":null,"profile_link_color":"0099B9","is_translator":false,"profile_sidebar_border_color":"5ED4DC","followers_count":528,"profile_use_background_image":true,"created_at":"Sun Mar 08 04:52:10 +0000 2009","location":"SE USA","listed_count":7,"profile_background_color":"0099B9","show_all_inline_media":false,"geo_enabled":false,"profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/17691490\/Bloom.jpg","friends_count":550,"description":"tech, motorcycles, photography, music, green, generally curious","statuses_count":6008,"favourites_count":95,"time_zone":"Central Time (US & Canada)","profile_text_color":"3C3940","protected":false,"url":null,"profile_image_url":"http:\/\/a3.twimg.com\/profile_images\/287875274\/Speedo_normal.jpg","notifications":null,"profile_sidebar_fill_color":"95E8EC","name":"Henk Sijgers","id_str":"23277821","contributors_enabled":false,"lang":"en","profile_background_tile":false,"screen_name":"henksijgers","id":23277821,"following":null,"verified":false,"utc_offset":-21600},"coordinates":null,"retweet_count":6,"truncated":true,"text":"RT @SultanAlQassemi: LA Times: Al Jazeera English hopes coverage of Egypt will boost reach in US http:\/\/lat.ms\/gmb15c I salute @AJEnglis ...","favorited":false,"created_at":"Sat Feb 05 15:13:00 +0000 2011","in_reply_to_user_id":null,"in_reply_to_status_id":null,"source":"\u003Ca href=\"http:\/\/itunes.apple.com\/app\/twitter\/id333903271?mt=8\" rel=\"nofollow\"\u003ETwitter for iPad\u003C\/a\u003E","in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"entities":{"hashtags":[],"urls":[{"indices":[97,117],"url":"http:\/\/lat.ms\/gmb15c","expanded_url":null}],"user_mentions":[{"indices":[3,19],"name":"Sultan Al Qassemi","screen_name":"SultanAlQassemi","id_str":"46744791","id":46744791},{"indices":[127,136],"name":"Mahandini Teukie","screen_name":"ajenglis","id_str":"241013489","id":241013489}]},"contributors":null,"place":null,"geo":null,"retweeted":false,"in_reply_to_user_id_str":null,"id_str":"33905938419159040","retweeted_status":{"user":{"follow_request_sent":null,"profile_link_color":"009999","is_translator":false,"profile_sidebar_border_color":"eeeeee","followers_count":27255,"profile_use_background_image":true,"created_at":"Fri Jun 12 20:47:01 +0000 2009","location":"\u00dcT: 25.206282,55.281949","listed_count":1794,"profile_background_color":"131516","show_all_inline_media":true,"geo_enabled":false,"profile_background_image_url":"http:\/\/a3.twimg.com\/profile_background_images\/192936036\/TunisiaFlag.jpg","friends_count":187,"description":"Sultan Sooud Al Qassemi is a columnist for The National.","statuses_count":9767,"favourites_count":296,"time_zone":"Abu Dhabi","profile_text_color":"333333","protected":false,"url":null,"profile_image_url":"http:\/\/a3.twimg.com\/profile_images\/1216179693\/FreeTunisia_normal.jpg","notifications":null,"profile_sidebar_fill_color":"efefef","name":"Sultan Al Qassemi","id_str":"46744791","contributors_enabled":false,"lang":"en","profile_background_tile":true,"screen_name":"SultanAlQassemi","id":46744791,"following":null,"verified":false,"utc_offset":14400},"coordinates":null,"retweet_count":6,"truncated":false,"text":"LA Times: Al Jazeera English hopes coverage of Egypt will boost reach in US http:\/\/lat.ms\/gmb15c I salute @AJEnglish's coverage of Egypt","favorited":false,"created_at":"Sat Feb 05 15:11:42 +0000 2011","in_reply_to_user_id":null,"in_reply_to_status_id":null,"source":"web","in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"entities":{"hashtags":[],"urls":[{"indices":[76,96],"url":"http:\/\/lat.ms\/gmb15c","expanded_url":null}],"user_mentions":[{"indices":[106,116],"name":"Al Jazeera English","screen_name":"AJEnglish","id_str":"4970411","id":4970411}]},"contributors":null,"place":null,"geo":null,"retweeted":false,"in_reply_to_user_id_str":null,"id_str":"33905612630794240","id":33905612630794240},"id":33905938419159040}
{"user":{"statuses_count":774,"profile_link_color":"1581d5","profile_sidebar_border_color":"fac1d8","followers_count":77,"contributors_enabled":false,"profile_use_background_image":true,"created_at":"Tue May 19 19:16:34 +0000 2009","location":"Salina, Kansas","verified":false,"profile_background_color":"b8b7b8","follow_request_sent":null,"profile_background_image_url":"http:\/\/a3.twimg.com\/profile_background_images\/163464585\/twitterbg.jpg","description":"I am a woman of many titles: Mom, college student, daughter, wife, photographer, artist, humanitarian, book addict","is_translator":false,"favourites_count":4,"time_zone":"Central Time (US & Canada)","profile_text_color":"1a1415","protected":false,"url":null,"profile_image_url":"http:\/\/a1.twimg.com\/profile_images\/1151807480\/profile_normal.jpg","notifications":null,"profile_sidebar_fill_color":"f6c1c4","name":"Holly Williams","id_str":"41185779","listed_count":4,"lang":"en","profile_background_tile":true,"screen_name":"hwilliams83","id":41185779,"show_all_inline_media":false,"following":null,"geo_enabled":true,"utc_offset":-21600,"friends_count":158},"coordinates":null,"retweet_count":32,"truncated":false,"text":"RT @petapixel: Egypt protests turn violent: http:\/\/j.mp\/gfErjh","favorited":false,"created_at":"Sat Feb 05 15:13:00 +0000 2011","in_reply_to_user_id":null,"in_reply_to_status_id":null,"source":"web","in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"entities":{"hashtags":[],"urls":[{"indices":[44,62],"url":"http:\/\/j.mp\/gfErjh","expanded_url":null}],"user_mentions":[{"indices":[3,13],"name":"PetaPixel","screen_name":"petapixel","id_str":"37971731","id":37971731}]},"contributors":null,"place":null,"geo":null,"retweeted":false,"in_reply_to_user_id_str":null,"id_str":"33905940545671169","retweeted_status":{"user":{"statuses_count":4938,"profile_link_color":"2855e9","profile_sidebar_border_color":"dfe3ed","followers_count":80064,"contributors_enabled":false,"profile_use_background_image":true,"created_at":"Tue May 05 17:28:51 +0000 2009","location":"Berkeley, California","verified":false,"profile_background_color":"ffffff","follow_request_sent":null,"profile_background_image_url":"http:\/\/a3.twimg.com\/profile_background_images\/22970429\/twitterbg.jpg","description":"A photography blog for the Web 2.0 generation. We also tweet the tastiest photo and art related links on the web!","is_translator":false,"favourites_count":0,"time_zone":"Pacific Time (US & Canada)","profile_text_color":"000000","protected":false,"url":"http:\/\/petapixel.com","profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/211156611\/avatar_normal.jpg","notifications":null,"profile_sidebar_fill_color":"f5f5f5","name":"PetaPixel","id_str":"37971731","listed_count":10367,"lang":"en","profile_background_tile":false,"screen_name":"petapixel","id":37971731,"show_all_inline_media":true,"following":null,"geo_enabled":false,"utc_offset":-28800,"friends_count":0},"coordinates":null,"retweet_count":32,"truncated":false,"text":"Egypt protests turn violent: http:\/\/j.mp\/gfErjh","favorited":false,"created_at":"Sat Feb 05 13:05:02 +0000 2011","in_reply_to_user_id":null,"in_reply_to_status_id":null,"source":"\u003Ca href=\"http:\/\/www.petapixel.com\" rel=\"nofollow\"\u003EPetaPixel\u003C\/a\u003E","in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"entities":{"hashtags":[],"urls":[{"indices":[29,47],"url":"http:\/\/j.mp\/gfErjh","expanded_url":null}],"user_mentions":[]},"contributors":null,"place":null,"geo":null,"retweeted":false,"in_reply_to_user_id_str":null,"id_str":"33873733726765056","id":33873733726765056},"id":33905940545671169}

这是我认为会更好的方法(不幸的是,我无法控制 twitter 发送的内容:
[
{"user":{"statuses_count":357,"profile_link_color":"93A644","profile_sidebar_border_color":"eeeeee","followers_count":28,"contributors_enabled":false,"profile_use_background_image":true,"created_at":"Fri Jun 04 22:45:23 +0000 2010","location":"Brazil","verified":false,"profile_background_color":"B2DFDA","follow_request_sent":null,"profile_background_image_url":"http:\/\/a3.twimg.com\/profile_background_images\/201416971\/egito.jpg","description":"Dare to defy the status quo!!! For a free Egypt!","is_translator":false,"favourites_count":14,"time_zone":"Brasilia","profile_text_color":"333333","protected":false,"url":null,"profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/1233185161\/Flag-Pins-Brazil-Egypt_normal.jpg","notifications":null,"profile_sidebar_fill_color":"ffffff","name":"lu costa","id_str":"152038309","listed_count":0,"lang":"en","profile_background_tile":true,"screen_name":"dacostalu","id":152038309,"show_all_inline_media":false,"following":null,"geo_enabled":false,"utc_offset":-10800,"friends_count":35},"coordinates":null,"retweet_count":49,"truncated":false,"text":"RT @arwasm: Protesters are calling for volunteers to be at the entrances to #tahrir. Entrances are more exposed than yesterday. #jan25 # ...","favorited":false,"created_at":"Sat Feb 05 15:13:00 +0000 2011","in_reply_to_user_id":null,"in_reply_to_status_id":null,"source":"web","in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"entities":{"hashtags":[{"indices":[76,83],"text":"tahrir"},{"indices":[128,134],"text":"jan25"}],"user_mentions":[{"indices":[3,10],"name":"Arwa Mahmoud","screen_name":"arwasm","id_str":"63693027","id":63693027}],"urls":[]},"contributors":null,"place":null,"geo":null,"retweeted":false,"in_reply_to_user_id_str":null,"id_str":"33905938754834432","retweeted_status":{"user":{"statuses_count":3057,"profile_link_color":"990000","profile_sidebar_border_color":"DFDFDF","followers_count":1468,"contributors_enabled":false,"profile_use_background_image":true,"created_at":"Fri Aug 07 11:21:27 +0000 2009","location":"Cairo, Egypt","verified":false,"profile_background_color":"EBEBEB","follow_request_sent":null,"profile_background_image_url":"http:\/\/a2.twimg.com\/profile_background_images\/70305782\/even_smaller.jpg","description":"Writer, blogger, mountaineer wannabe. Author of A Battle of Creed & \u0642\u062a\u0627\u0644 \u062d\u0632\u0628 \u0627\u0644\u0644\u0647. Falls head over heals with every mountain she meets!","is_translator":false,"favourites_count":0,"time_zone":"Santiago","profile_text_color":"333333","protected":false,"url":"http:\/\/www.alhurr.com","profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/1233059668\/e296709a-cb86-45fd-aa75-89d3fa8a02ac_normal.png","notifications":null,"profile_sidebar_fill_color":"F3F3F3","name":"Arwa Mahmoud","id_str":"63693027","listed_count":156,"lang":"en","profile_background_tile":true,"screen_name":"arwasm","id":63693027,"show_all_inline_media":false,"following":null,"geo_enabled":false,"utc_offset":-14400,"friends_count":182},"coordinates":null,"retweet_count":49,"truncated":false,"text":"Protesters are calling for volunteers to be at the entrances to #tahrir. Entrances are more exposed than yesterday. #jan25 #egypt","favorited":false,"created_at":"Sat Feb 05 14:40:39 +0000 2011","in_reply_to_user_id":null,"in_reply_to_status_id":null,"source":"\u003Ca href=\"http:\/\/blackberry.com\/twitter\" rel=\"nofollow\"\u003ETwitter for BlackBerry\u00ae\u003C\/a\u003E","in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"entities":{"hashtags":[{"indices":[64,71],"text":"tahrir"},{"indices":[116,122],"text":"jan25"},{"indices":[123,129],"text":"egypt"}],"user_mentions":[],"urls":[]},"contributors":null,"place":null,"geo":null,"retweeted":false,"in_reply_to_user_id_str":null,"id_str":"33897797342199808","id":33897797342199808},"id":33905938754834432},
{"user":{"follow_request_sent":null,"profile_link_color":"0099B9","is_translator":false,"profile_sidebar_border_color":"5ED4DC","followers_count":528,"profile_use_background_image":true,"created_at":"Sun Mar 08 04:52:10 +0000 2009","location":"SE USA","listed_count":7,"profile_background_color":"0099B9","show_all_inline_media":false,"geo_enabled":false,"profile_background_image_url":"http:\/\/a0.twimg.com\/profile_background_images\/17691490\/Bloom.jpg","friends_count":550,"description":"tech, motorcycles, photography, music, green, generally curious","statuses_count":6008,"favourites_count":95,"time_zone":"Central Time (US & Canada)","profile_text_color":"3C3940","protected":false,"url":null,"profile_image_url":"http:\/\/a3.twimg.com\/profile_images\/287875274\/Speedo_normal.jpg","notifications":null,"profile_sidebar_fill_color":"95E8EC","name":"Henk Sijgers","id_str":"23277821","contributors_enabled":false,"lang":"en","profile_background_tile":false,"screen_name":"henksijgers","id":23277821,"following":null,"verified":false,"utc_offset":-21600},"coordinates":null,"retweet_count":6,"truncated":true,"text":"RT @SultanAlQassemi: LA Times: Al Jazeera English hopes coverage of Egypt will boost reach in US http:\/\/lat.ms\/gmb15c I salute @AJEnglis ...","favorited":false,"created_at":"Sat Feb 05 15:13:00 +0000 2011","in_reply_to_user_id":null,"in_reply_to_status_id":null,"source":"\u003Ca href=\"http:\/\/itunes.apple.com\/app\/twitter\/id333903271?mt=8\" rel=\"nofollow\"\u003ETwitter for iPad\u003C\/a\u003E","in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"entities":{"hashtags":[],"urls":[{"indices":[97,117],"url":"http:\/\/lat.ms\/gmb15c","expanded_url":null}],"user_mentions":[{"indices":[3,19],"name":"Sultan Al Qassemi","screen_name":"SultanAlQassemi","id_str":"46744791","id":46744791},{"indices":[127,136],"name":"Mahandini Teukie","screen_name":"ajenglis","id_str":"241013489","id":241013489}]},"contributors":null,"place":null,"geo":null,"retweeted":false,"in_reply_to_user_id_str":null,"id_str":"33905938419159040","retweeted_status":{"user":{"follow_request_sent":null,"profile_link_color":"009999","is_translator":false,"profile_sidebar_border_color":"eeeeee","followers_count":27255,"profile_use_background_image":true,"created_at":"Fri Jun 12 20:47:01 +0000 2009","location":"\u00dcT: 25.206282,55.281949","listed_count":1794,"profile_background_color":"131516","show_all_inline_media":true,"geo_enabled":false,"profile_background_image_url":"http:\/\/a3.twimg.com\/profile_background_images\/192936036\/TunisiaFlag.jpg","friends_count":187,"description":"Sultan Sooud Al Qassemi is a columnist for The National.","statuses_count":9767,"favourites_count":296,"time_zone":"Abu Dhabi","profile_text_color":"333333","protected":false,"url":null,"profile_image_url":"http:\/\/a3.twimg.com\/profile_images\/1216179693\/FreeTunisia_normal.jpg","notifications":null,"profile_sidebar_fill_color":"efefef","name":"Sultan Al Qassemi","id_str":"46744791","contributors_enabled":false,"lang":"en","profile_background_tile":true,"screen_name":"SultanAlQassemi","id":46744791,"following":null,"verified":false,"utc_offset":14400},"coordinates":null,"retweet_count":6,"truncated":false,"text":"LA Times: Al Jazeera English hopes coverage of Egypt will boost reach in US http:\/\/lat.ms\/gmb15c I salute @AJEnglish's coverage of Egypt","favorited":false,"created_at":"Sat Feb 05 15:11:42 +0000 2011","in_reply_to_user_id":null,"in_reply_to_status_id":null,"source":"web","in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"entities":{"hashtags":[],"urls":[{"indices":[76,96],"url":"http:\/\/lat.ms\/gmb15c","expanded_url":null}],"user_mentions":[{"indices":[106,116],"name":"Al Jazeera English","screen_name":"AJEnglish","id_str":"4970411","id":4970411}]},"contributors":null,"place":null,"geo":null,"retweeted":false,"in_reply_to_user_id_str":null,"id_str":"33905612630794240","id":33905612630794240},"id":33905938419159040},
{"user":{"statuses_count":774,"profile_link_color":"1581d5","profile_sidebar_border_color":"fac1d8","followers_count":77,"contributors_enabled":false,"profile_use_background_image":true,"created_at":"Tue May 19 19:16:34 +0000 2009","location":"Salina, Kansas","verified":false,"profile_background_color":"b8b7b8","follow_request_sent":null,"profile_background_image_url":"http:\/\/a3.twimg.com\/profile_background_images\/163464585\/twitterbg.jpg","description":"I am a woman of many titles: Mom, college student, daughter, wife, photographer, artist, humanitarian, book addict","is_translator":false,"favourites_count":4,"time_zone":"Central Time (US & Canada)","profile_text_color":"1a1415","protected":false,"url":null,"profile_image_url":"http:\/\/a1.twimg.com\/profile_images\/1151807480\/profile_normal.jpg","notifications":null,"profile_sidebar_fill_color":"f6c1c4","name":"Holly Williams","id_str":"41185779","listed_count":4,"lang":"en","profile_background_tile":true,"screen_name":"hwilliams83","id":41185779,"show_all_inline_media":false,"following":null,"geo_enabled":true,"utc_offset":-21600,"friends_count":158},"coordinates":null,"retweet_count":32,"truncated":false,"text":"RT @petapixel: Egypt protests turn violent: http:\/\/j.mp\/gfErjh","favorited":false,"created_at":"Sat Feb 05 15:13:00 +0000 2011","in_reply_to_user_id":null,"in_reply_to_status_id":null,"source":"web","in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"entities":{"hashtags":[],"urls":[{"indices":[44,62],"url":"http:\/\/j.mp\/gfErjh","expanded_url":null}],"user_mentions":[{"indices":[3,13],"name":"PetaPixel","screen_name":"petapixel","id_str":"37971731","id":37971731}]},"contributors":null,"place":null,"geo":null,"retweeted":false,"in_reply_to_user_id_str":null,"id_str":"33905940545671169","retweeted_status":{"user":{"statuses_count":4938,"profile_link_color":"2855e9","profile_sidebar_border_color":"dfe3ed","followers_count":80064,"contributors_enabled":false,"profile_use_background_image":true,"created_at":"Tue May 05 17:28:51 +0000 2009","location":"Berkeley, California","verified":false,"profile_background_color":"ffffff","follow_request_sent":null,"profile_background_image_url":"http:\/\/a3.twimg.com\/profile_background_images\/22970429\/twitterbg.jpg","description":"A photography blog for the Web 2.0 generation. We also tweet the tastiest photo and art related links on the web!","is_translator":false,"favourites_count":0,"time_zone":"Pacific Time (US & Canada)","profile_text_color":"000000","protected":false,"url":"http:\/\/petapixel.com","profile_image_url":"http:\/\/a0.twimg.com\/profile_images\/211156611\/avatar_normal.jpg","notifications":null,"profile_sidebar_fill_color":"f5f5f5","name":"PetaPixel","id_str":"37971731","listed_count":10367,"lang":"en","profile_background_tile":false,"screen_name":"petapixel","id":37971731,"show_all_inline_media":true,"following":null,"geo_enabled":false,"utc_offset":-28800,"friends_count":0},"coordinates":null,"retweet_count":32,"truncated":false,"text":"Egypt protests turn violent: http:\/\/j.mp\/gfErjh","favorited":false,"created_at":"Sat Feb 05 13:05:02 +0000 2011","in_reply_to_user_id":null,"in_reply_to_status_id":null,"source":"\u003Ca href=\"http:\/\/www.petapixel.com\" rel=\"nofollow\"\u003EPetaPixel\u003C\/a\u003E","in_reply_to_screen_name":null,"in_reply_to_status_id_str":null,"entities":{"hashtags":[],"urls":[{"indices":[29,47],"url":"http:\/\/j.mp\/gfErjh","expanded_url":null}],"user_mentions":[]},"contributors":null,"place":null,"geo":null,"retweeted":false,"in_reply_to_user_id_str":null,"id_str":"33873733726765056","id":33873733726765056},"id":33905940545671169}
]

最佳答案

这其实很简单...我只需要检查数据是否以\r\n结尾然后在释放它并创建一个新的之前存储我的解析器的结果。

关于json - YAJL 流解析和 Twitter 流 API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4908293/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com