twitter-nodejs-websocket
twitter-nodejs-websocket copied to clipboard
"Unexpected token ILLEGAL" error happens in index.html
"Unexpected token ILLEGAL" error happens at the line 15 in index.html. Obviously the script in index.html fails to parse string into JSON.
I believe that happens because some tweets sent by the server is separated into several portions like below:
===== data sent at the first loop =============== {"geo":null,"in_reply_to_screen_name":null,"truncated":false,"text":"RT @xcrashingstars: @xcrashingstars http://t.co/MU6W6Yu","in_reply_to_user_id_str":null,"contributors":null,"retweeted":false,"retweet_count":0,"entities":{"hashtags":[],"urls":[{"indices":[36,55],"display_url":"twitpic.com/show/iphone/4y\u2026","expanded_url":"http://twitpic.com/show/iphone/4y6gln","url":"http://t.co/MU6W6Yu"}],"user_mentions":[{"indices":[3,18],"name":"W.","screen_name":"xcrashingstars","id":205399222,"id_str":"205399222"},{"indices":[20,35],"name":"W.","screen_name":"xcrashingstars","id":205399222,"id_str":"205399222"}]},"coordinates":null,"retweeted_status":{"geo":null,"in_reply_to_screen_name":"xcrashingstars","truncated":false,"text":"@xcrashingstars http://t.co/MU6W6Yu","in_reply_to_user_id_str":"205399222","contributors":null,"retweeted":false,"retweet_count":0,"entities":{"hashtags":[],"urls":[{"indices":[16,35],"display_url":"twitpic.com/show/iphone/4y\u2026","expanded_url":"http://twitpic.com/show/iphone/4y6gln","url":"http://t.co/MU6W6Yu"}],"user_mentions":[{"indices":[0,15],"name":"W.","screen_name":"xcrashingstars","id":205399222,"id_str":"205399222"}]},"coordinates":null,"place":null,"source":"web","created_at":"Sat Aug 27 21:52:35 +0000 2011","in_reply_to_user_id":205399222
===== data sent at the second loop =============== ,"user":{"listed_count":19,"favourites_count":1096,"profile_sidebar_fill_color":"e6e6e6","location":"neverland","profile_background_tile":false,"lang":"it","profile_link_color":"000000","description":"She doesn't wanna feel this way. \r\n@xsheisfearless baby you light my world up like nobody else \u2665\r\n\r\n","default_profile_image":false,"verified":false,"profile_sidebar_border_color":"080808","notifications":null,"time_zone":null,"created_at":"Wed Oct 20 19:56:45 +0000 2010","followers_count":1402,"following":null,"profile_use_background_image":true,"profile_background_image_url_https":"https://si0.twimg.com/profile_background_images/320300844/bg.jpg","profile_image_url":"http://a2.twimg.com/profile_images/1516117505/icon2_normal.png","show_all_inline_media":false,"follow_request_sent":null,"geo_enabled":false,"profile_background_color":"000000","protected":false,"contributors_enabled":false,"profile_background_image_url":"http://a0.twimg.com/profile_background_images/320300844/bg.jpg","url":null,"screen_name":"xcrashingstars","name":"W.","default_profile":false,"friends_count":1702,"profile_image_url_https":"https://si0.twimg.com/profile_images/1516117505/icon2_normal.png","id":205399222,"id_str":"205399222","is_translator":false,"statuses_count":23371,"utc_offset":null,"profile_text_color":"000000"},"in_reply_to_status_id":null,"favorited":false,"id":107571234417545216,"possibly_sensitive":false,"in_reply_to_status_id_str":null,"id_str":"107571234417545216"},"place":null,"source":"web","created_at":"Sun Aug 28 00:09:47 +0000 2011","in_reply_to_user_id":null,"user":{"listed_count":133,"favourites_count":268,"profile_sidebar_fill_color":"000000","location":"Hogwarts.","profile_background_tile":false,"lang":"en","profile_link_color":"62627f","description":"\u221e I think love is fearless,so stay strong and live like there's no tomorrow.\u2665\r\n15thmarch2011.\r\n@xcrashingstars Eri solo da incontrare,ma tu ci sei sempre stata.","default_profile_image":false,"verified":false,"profile_sidebar_border_color":"000000","notifications":null,"time_zone":"Hawaii","created_at":"Tue May 26 19:29:55 +0000 2009","followers_count":1452,"following":null,"profile_use_background_image":true,"profile_background_image_url_https":"https://si0.twimg.com/profile_background_images/288378980/tumblr_lo73tinW8M1qd9f2io1_500.jpg","profile_image_url":"http://a2.twimg.com/profile_images/1513310681/photo_normal.jpeg","show_all_inline_media":false,"follow_request_sent":null,"geo_enabled":true,"profile_background_color":"000000","protected":false,"contributors_enabled":false,"profile_background
===== data sent at the third loop =============== _image_url":"http://a0.twimg.com/profile_background_images/288378980/tumblr_lo73tinW8M1qd9f2io1_500.jpg","url":null,"screen_name":"xsheisfearless","name":"Camilla.","default_profile":false,"friends_count":1286,"profile_image_url_https":"https://si0.twimg.com/profile_images/1513310681/photo_normal.jpeg","id":42698538,"id_str":"42698538","is_translator":false,"statuses_count":20114,"utc_offset":-36000,"profile_text_color":"5369d6"},"in_reply_to_status_id":null,"favorited":false,"id":107605760032247809,"possibly_sensitive":false,"in_reply_to_status_id_str":null,"id_str":"107605760032247809"}
I fix this problem and send pull request.
thanks.