brianmario-yajl-ruby 0.3.4 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. data/.gitignore +4 -0
  2. data/CHANGELOG.rdoc +13 -0
  3. data/MIT-LICENSE +20 -0
  4. data/README.rdoc +39 -3
  5. data/Rakefile +4 -12
  6. data/VERSION.yml +2 -2
  7. data/benchmark/http.rb +28 -0
  8. data/benchmark/stream.rb +40 -0
  9. data/benchmark/subjects/contacts.json +1 -0
  10. data/benchmark/subjects/item.json +1 -0
  11. data/benchmark/subjects/ohai.json +1216 -0
  12. data/benchmark/subjects/twitter_search.json +1 -0
  13. data/benchmark/subjects/unicode.json +3315 -0
  14. data/benchmark/subjects/yelp.json +1 -0
  15. data/ext/extconf.rb +1 -0
  16. data/ext/yajl.c +86 -40
  17. data/ext/yajl.h +45 -0
  18. data/lib/yajl/http_stream.rb +67 -0
  19. data/lib/yajl.rb +32 -0
  20. data/specs/active_support_spec.rb +50 -0
  21. data/specs/fixtures/fail.15.json +1 -0
  22. data/specs/fixtures/fail.16.json +1 -0
  23. data/specs/fixtures/fail.17.json +1 -0
  24. data/specs/fixtures/fail.26.json +1 -0
  25. data/specs/fixtures/fail11.json +1 -0
  26. data/specs/fixtures/fail12.json +1 -0
  27. data/specs/fixtures/fail13.json +1 -0
  28. data/specs/fixtures/fail14.json +1 -0
  29. data/specs/fixtures/fail19.json +1 -0
  30. data/specs/fixtures/fail20.json +1 -0
  31. data/specs/fixtures/fail21.json +1 -0
  32. data/specs/fixtures/fail22.json +1 -0
  33. data/specs/fixtures/fail23.json +1 -0
  34. data/specs/fixtures/fail24.json +1 -0
  35. data/specs/fixtures/fail25.json +1 -0
  36. data/specs/fixtures/fail27.json +2 -0
  37. data/specs/fixtures/fail28.json +2 -0
  38. data/specs/fixtures/fail3.json +1 -0
  39. data/specs/fixtures/fail4.json +1 -0
  40. data/specs/fixtures/fail5.json +1 -0
  41. data/specs/fixtures/fail6.json +1 -0
  42. data/specs/fixtures/fail9.json +1 -0
  43. data/specs/fixtures/pass.array.json +6 -0
  44. data/specs/fixtures/pass.codepoints_from_unicode_org.json +1 -0
  45. data/specs/fixtures/pass.contacts.json +1 -0
  46. data/specs/fixtures/pass.db100.xml.json +1 -0
  47. data/specs/fixtures/pass.db1000.xml.json +1 -0
  48. data/specs/fixtures/pass.dc_simple_with_comments.json +11 -0
  49. data/specs/fixtures/pass.deep_arrays.json +1 -0
  50. data/specs/fixtures/pass.difficult_json_c_test_case.json +1 -0
  51. data/specs/fixtures/pass.difficult_json_c_test_case_with_comments.json +1 -0
  52. data/specs/fixtures/pass.doubles.json +1 -0
  53. data/specs/fixtures/pass.empty_array.json +1 -0
  54. data/specs/fixtures/pass.empty_string.json +1 -0
  55. data/specs/fixtures/pass.escaped_bulgarian.json +4 -0
  56. data/specs/fixtures/pass.escaped_foobar.json +1 -0
  57. data/specs/fixtures/pass.item.json +1 -0
  58. data/specs/fixtures/pass.json-org-sample1.json +23 -0
  59. data/specs/fixtures/pass.json-org-sample2.json +11 -0
  60. data/specs/fixtures/pass.json-org-sample3.json +26 -0
  61. data/specs/fixtures/pass.json-org-sample4-nows.json +88 -0
  62. data/specs/fixtures/pass.json-org-sample4.json +89 -0
  63. data/specs/fixtures/pass.json-org-sample5.json +27 -0
  64. data/specs/fixtures/pass.map-spain.xml.json +1 -0
  65. data/specs/fixtures/pass.ns-invoice100.xml.json +1 -0
  66. data/specs/fixtures/pass.ns-soap.xml.json +1 -0
  67. data/specs/fixtures/pass.numbers-fp-4k.json +6 -0
  68. data/specs/fixtures/pass.numbers-fp-64k.json +61 -0
  69. data/specs/fixtures/pass.numbers-int-4k.json +11 -0
  70. data/specs/fixtures/pass.numbers-int-64k.json +154 -0
  71. data/specs/fixtures/pass.twitter-search.json +1 -0
  72. data/specs/fixtures/pass.twitter-search2.json +1 -0
  73. data/specs/fixtures/pass.unicode.json +3315 -0
  74. data/specs/fixtures/pass.yelp.json +1 -0
  75. data/specs/fixtures/pass1.json +56 -0
  76. data/specs/fixtures/pass2.json +1 -0
  77. data/specs/fixtures/pass3.json +6 -0
  78. data/specs/fixtures_spec.rb +25 -0
  79. data/specs/one_off_spec.rb +11 -0
  80. data/specs/spec_helper.rb +4 -0
  81. data/yajl-ruby.gemspec +115 -0
  82. metadata +79 -2
@@ -0,0 +1 @@
1
+ {"message": {"text": "OK", "code": 0, "version": 1.1000000000000001}, "businesses": [{"rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4_half.png", "country_code": "US", "id": "7vqUGG9ZBZKOjOFPs8lEgQ", "is_closed": false, "city": "San Francisco", "mobile_url": "http://mobile.yelp.com/biz/7vqUGG9ZBZKOjOFPs8lEgQ", "review_count": 223, "zip": "94103", "state": "CA", "latitude": 37.775596, "rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4_half.png", "address1": "1168 Folsom St", "address2": "", "address3": "", "phone": "4155031033", "state_code": "CA", "categories": [{"category_filter": "beer_and_wine", "search_url": "http://www.yelp.com/search?find_loc=1168+Folsom+St%2C+San+Francisco%2C+CA+94103&cflt=beer_and_wine", "name": "Beer, Wine & Spirits"}, {"category_filter": "wine_bars", "search_url": "http://www.yelp.com/search?find_loc=1168+Folsom+St%2C+San+Francisco%2C+CA+94103&cflt=wine_bars", "name": "Wine Bars"}], "photo_url": "http://static.px.yelp.com/bpthumb/QS62ET0YNIqDYzQlmeKtRQ/ms", "distance": 0.54462140798568726, "name": "The City Beer Store & Tasting Bar", "neighborhoods": [{"url": "http://www.yelp.com/search?find_loc=SOMA%2C+San+Francisco%2C+CA", "name": "SOMA"}], "url": "http://www.yelp.com/biz/the-city-beer-store-and-tasting-bar-san-francisco", "country": "USA", "avg_rating": 4.5, "longitude": -122.40933699999999, "photo_url_small": "http://static.px.yelp.com/bpthumb/QS62ET0YNIqDYzQlmeKtRQ/ss", "reviews": [{"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/CjwEJm0_LW7l3Gtc96Nq_A/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4.png", "rating": 4, "mobile_uri": "http://mobile.yelp.com/biz/7vqUGG9ZBZKOjOFPs8lEgQ?srid=prmIARCGNmaIKQj-szj0FQ", "url": "http://www.yelp.com/biz/the-city-beer-store-and-tasting-bar-san-francisco#hrid:prmIARCGNmaIKQj-szj0FQ", "user_url": "http://www.yelp.com/user_details?userid=LnZUtFx6qTWs8NV6lAARxQ", "text_excerpt": "Not that I need to remind people of this awesome place, but I need to really drop some knowledge: It's cheaper to have a specialty brew here than to go to...", "user_photo_url": "http://static.px.yelp.com/upthumb/CjwEJm0_LW7l3Gtc96Nq_A/ms", "date": "2009-04-18", "user_name": "Lisa N.", "id": "prmIARCGNmaIKQj-szj0FQ"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/fXjNyGsXPVjIHk46Y5dPrA/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/7vqUGG9ZBZKOjOFPs8lEgQ?srid=5U87A3dHbLN55unJLj0VjQ", "url": "http://www.yelp.com/biz/the-city-beer-store-and-tasting-bar-san-francisco#hrid:5U87A3dHbLN55unJLj0VjQ", "user_url": "http://www.yelp.com/user_details?userid=XDQCUG6dB_NntrZNsn5Frw", "text_excerpt": "Once in a while, I come across a place that I hesitate to write a review, because I want it to be a secret . . . because it is such a rare treasure. . .The...", "user_photo_url": "http://static.px.yelp.com/upthumb/fXjNyGsXPVjIHk46Y5dPrA/ms", "date": "2009-04-12", "user_name": "Su K.", "id": "5U87A3dHbLN55unJLj0VjQ"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/Wzjwe41JVxcJ8S1T6FMJlQ/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/7vqUGG9ZBZKOjOFPs8lEgQ?srid=OhJUOg-CPz6JPs9l6p8xZg", "url": "http://www.yelp.com/biz/the-city-beer-store-and-tasting-bar-san-francisco#hrid:OhJUOg-CPz6JPs9l6p8xZg", "user_url": "http://www.yelp.com/user_details?userid=kzkAXy9mJS6gMljzC4xGXw", "text_excerpt": "This place absolutely rules! Forget BevMo or any other half assed excuse of a liquor store for trying to find the dankest of the dank.\n\nYou want REAL...", "user_photo_url": "http://static.px.yelp.com/upthumb/Wzjwe41JVxcJ8S1T6FMJlQ/ms", "date": "2009-04-10", "user_name": "Gary T.", "id": "OhJUOg-CPz6JPs9l6p8xZg"}], "nearby_url": "http://www.yelp.com/search?find_loc=1168+Folsom+St%2C+San+Francisco%2C+CA+94103"}, {"rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4_half.png", "country_code": "US", "id": "bJm7lxFjXPTg1yJ3WBikMg", "is_closed": false, "city": "San Francisco", "mobile_url": "http://mobile.yelp.com/biz/bJm7lxFjXPTg1yJ3WBikMg", "review_count": 332, "zip": "94109", "state": "CA", "latitude": 37.787863000000002, "rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4_half.png", "address1": "620 Post St", "address2": "", "address3": "", "phone": "4156743567", "state_code": "CA", "categories": [{"category_filter": "wine_bars", "search_url": "http://www.yelp.com/search?find_loc=620+Post+St%2C+San+Francisco%2C+CA+94109&cflt=wine_bars", "name": "Wine Bars"}], "photo_url": "http://static.px.yelp.com/bpthumb/K7_INof0EiUXR52hv5jfiQ/ms", "distance": 0.97077900171279907, "name": "The Hidden Vine", "neighborhoods": [{"url": "http://www.yelp.com/search?find_loc=Civic+Center%2FTenderloin%2C+San+Francisco%2C+CA", "name": "Civic Center/Tenderloin"}, {"url": "http://www.yelp.com/search?find_loc=Nob+Hill%2C+San+Francisco%2C+CA", "name": "Nob Hill"}], "url": "http://www.yelp.com/biz/the-hidden-vine-san-francisco", "country": "USA", "avg_rating": 4.5, "longitude": -122.41209499999999, "photo_url_small": "http://static.px.yelp.com/bpthumb/K7_INof0EiUXR52hv5jfiQ/ss", "reviews": [{"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/yswMVVQ6HUVHHrs_5H5GPw/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/bJm7lxFjXPTg1yJ3WBikMg?srid=EHIPPWgySoXzd_YJpkjqyA", "url": "http://www.yelp.com/biz/the-hidden-vine-san-francisco#hrid:EHIPPWgySoXzd_YJpkjqyA", "user_url": "http://www.yelp.com/user_details?userid=M_4EmxzznybTzMwT7FDg_g", "text_excerpt": "I better write this before I forget about going here and how good it was. Too late! It's almost a fading memory. \n\nI do remember several kinds of wine,...", "user_photo_url": "http://static.px.yelp.com/upthumb/yswMVVQ6HUVHHrs_5H5GPw/ms", "date": "2009-04-16", "user_name": "Michael M.", "id": "EHIPPWgySoXzd_YJpkjqyA"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/g9ivlET2xM1MFi_C_Ktrbg/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4.png", "rating": 4, "mobile_uri": "http://mobile.yelp.com/biz/bJm7lxFjXPTg1yJ3WBikMg?srid=0SEtOwc5fxrk9E4BzOX3Lg", "url": "http://www.yelp.com/biz/the-hidden-vine-san-francisco#hrid:0SEtOwc5fxrk9E4BzOX3Lg", "user_url": "http://www.yelp.com/user_details?userid=mg4gZL6QRMSX-lnLFyEKAg", "text_excerpt": "Best most quaint wine bar in town, try a flight of red or white, and enjoy the music and cozy European-style ambiance.", "user_photo_url": "http://static.px.yelp.com/upthumb/g9ivlET2xM1MFi_C_Ktrbg/ms", "date": "2009-04-16", "user_name": "PJ T.", "id": "0SEtOwc5fxrk9E4BzOX3Lg"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/afmXmGSDfksrEhrEJauNJw/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/bJm7lxFjXPTg1yJ3WBikMg?srid=A3dtzAGxYjRb5lh1mUSOhg", "url": "http://www.yelp.com/biz/the-hidden-vine-san-francisco#hrid:A3dtzAGxYjRb5lh1mUSOhg", "user_url": "http://www.yelp.com/user_details?userid=qD51vvp5Zf5DgPEGy7yfDQ", "text_excerpt": "The terms, \"cozy\" and \"intimate\" have been used frequently in the reviews, and I can't think of better descriptives for The Hidden Vine. For a perpetual...", "user_photo_url": "http://static.px.yelp.com/upthumb/afmXmGSDfksrEhrEJauNJw/ms", "date": "2009-04-15", "user_name": "Marsha Z.", "id": "A3dtzAGxYjRb5lh1mUSOhg"}], "nearby_url": "http://www.yelp.com/search?find_loc=620+Post+St%2C+San+Francisco%2C+CA+94109"}, {"rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4_half.png", "country_code": "US", "id": "rPwB56EQ9JfEo2mN24fqOQ", "is_closed": false, "city": "San Francisco", "mobile_url": "http://mobile.yelp.com/biz/rPwB56EQ9JfEo2mN24fqOQ", "review_count": 63, "zip": "94122", "state": "CA", "latitude": 37.765385700000003, "rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4_half.png", "address1": "1849 Lincoln Way", "address2": "", "address3": "", "phone": "4152429930", "state_code": "CA", "categories": [{"category_filter": "sportsbars", "search_url": "http://www.yelp.com/search?find_loc=1849+Lincoln+Way%2C+San+Francisco%2C+CA+94122&cflt=sportsbars", "name": "Sports Bars"}, {"category_filter": "pubs", "search_url": "http://www.yelp.com/search?find_loc=1849+Lincoln+Way%2C+San+Francisco%2C+CA+94122&cflt=pubs", "name": "Pubs"}], "photo_url": "http://static.px.yelp.com/bpthumb/Qi-qAAMOBSuXunNQMb2ttw/ms", "distance": 3.2772026062011719, "name": "Chug Pub", "neighborhoods": [], "url": "http://www.yelp.com/biz/chug-pub-san-francisco", "country": "USA", "avg_rating": 4.5, "longitude": -122.4780387, "photo_url_small": "http://static.px.yelp.com/bpthumb/Qi-qAAMOBSuXunNQMb2ttw/ss", "reviews": [{"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/hYTM9RV4e8642z2NCNty2A/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4.png", "rating": 4, "mobile_uri": "http://mobile.yelp.com/biz/rPwB56EQ9JfEo2mN24fqOQ?srid=jLYJ2se_DN73QiAogNfnJQ", "url": "http://www.yelp.com/biz/chug-pub-san-francisco#hrid:jLYJ2se_DN73QiAogNfnJQ", "user_url": "http://www.yelp.com/user_details?userid=RjQkoF8llTiXoO1bc4gOMQ", "text_excerpt": "Okay, so we met a couple of girls who brought us to this place late Monday night.... we got closed out on the other restaurant and we wanted to have a few...", "user_photo_url": "http://static.px.yelp.com/upthumb/hYTM9RV4e8642z2NCNty2A/ms", "date": "2009-04-08", "user_name": "John R.", "id": "jLYJ2se_DN73QiAogNfnJQ"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/nXk12V7x30v9LUoTye0gsw/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/rPwB56EQ9JfEo2mN24fqOQ?srid=kZgc0_KkkGy0cmi2C7fEHA", "url": "http://www.yelp.com/biz/chug-pub-san-francisco#hrid:kZgc0_KkkGy0cmi2C7fEHA", "user_url": "http://www.yelp.com/user_details?userid=ipleTHGh9KR8hO5U1yxzXw", "text_excerpt": "I'm all for phallic innuendo. The sexual implications of beer bongs is not lost on me and I adore the flavor of Blowjobs and yes I do like whipped cream on...", "user_photo_url": "http://static.px.yelp.com/upthumb/nXk12V7x30v9LUoTye0gsw/ms", "date": "2009-04-06", "user_name": "jay h.", "id": "kZgc0_KkkGy0cmi2C7fEHA"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/QNtJA5nm_FuSnwTzVcXhag/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4.png", "rating": 4, "mobile_uri": "http://mobile.yelp.com/biz/rPwB56EQ9JfEo2mN24fqOQ?srid=o45vWqKfPlGTSaYwK7Ziug", "url": "http://www.yelp.com/biz/chug-pub-san-francisco#hrid:o45vWqKfPlGTSaYwK7Ziug", "user_url": "http://www.yelp.com/user_details?userid=21SRsnSJqvk3gWXY1iDRiQ", "text_excerpt": "This is a great place to go for nachos. They also have a great special. Last time I was there it was a shot of Cobo Wabo and a Pabst for $6. It has a...", "user_photo_url": "http://static.px.yelp.com/upthumb/QNtJA5nm_FuSnwTzVcXhag/ms", "date": "2009-03-17", "user_name": "Jared S.", "id": "o45vWqKfPlGTSaYwK7Ziug"}], "nearby_url": "http://www.yelp.com/search?find_loc=1849+Lincoln+Way%2C+San+Francisco%2C+CA+94122"}, {"rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4_half.png", "country_code": "US", "id": "z_kf-vKkCLI1WTnEBSPudw", "is_closed": false, "city": "San Francisco", "mobile_url": "http://mobile.yelp.com/biz/z_kf-vKkCLI1WTnEBSPudw", "review_count": 68, "zip": "94103", "state": "CA", "latitude": 37.786693, "rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4_half.png", "address1": "757 Market St.", "address2": "Inside The Four Seasons", "address3": "", "phone": "4156333000", "state_code": "CA", "categories": [{"category_filter": "lounges", "search_url": "http://www.yelp.com/search?find_loc=757+Market+St.%2C+San+Francisco%2C+CA+94103&cflt=lounges", "name": "Lounges"}], "photo_url": "http://static.px.yelp.com/bpthumb/anR-QVqjMYDupPLYJ5lqwQ/ms", "distance": 1.1350789070129395, "name": "The Bar At The Four Seasons", "neighborhoods": [{"url": "http://www.yelp.com/search?find_loc=SOMA%2C+San+Francisco%2C+CA", "name": "SOMA"}, {"url": "http://www.yelp.com/search?find_loc=Union+Square%2C+San+Francisco%2C+CA", "name": "Union Square"}], "url": "http://www.yelp.com/biz/the-bar-at-the-four-seasons-san-francisco", "country": "USA", "avg_rating": 4.5, "longitude": -122.404662, "photo_url_small": "http://static.px.yelp.com/bpthumb/anR-QVqjMYDupPLYJ5lqwQ/ss", "reviews": [{"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_3.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/t4zvXYHqYmm-QW0-Te2j1g/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_3.png", "rating": 3, "mobile_uri": "http://mobile.yelp.com/biz/z_kf-vKkCLI1WTnEBSPudw?srid=1IlPciKzq2Z0SZrsLSANsA", "url": "http://www.yelp.com/biz/the-bar-at-the-four-seasons-san-francisco#hrid:1IlPciKzq2Z0SZrsLSANsA", "user_url": "http://www.yelp.com/user_details?userid=UBAfc-KuDXV8XLurou_i6g", "text_excerpt": "Love the wine selection and \"lambsicles\"...Dee lish! \n\nFour Seasons pricing but of course ;) but a nice place to grab drinks with a few friends or larger...", "user_photo_url": "http://static.px.yelp.com/upthumb/t4zvXYHqYmm-QW0-Te2j1g/ms", "date": "2009-04-06", "user_name": "Abby W.", "id": "1IlPciKzq2Z0SZrsLSANsA"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4.png", "user_photo_url_small": "http://static.px.yelp.com/static/20090416/i/new/gfx/blank_user_extra_small.gif", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4.png", "rating": 4, "mobile_uri": "http://mobile.yelp.com/biz/z_kf-vKkCLI1WTnEBSPudw?srid=oia-XcRxPrqwx11GtCuw8Q", "url": "http://www.yelp.com/biz/the-bar-at-the-four-seasons-san-francisco#hrid:oia-XcRxPrqwx11GtCuw8Q", "user_url": "http://www.yelp.com/user_details?userid=1O1MfZlHbQx_U5G47a90JA", "text_excerpt": "This would be a 5, but I did not really like the dried peas and spicy almonds. Other than that the service was a 5. Wish i could remember the waitresses...", "user_photo_url": "http://static.px.yelp.com/static/20090416/i/new/gfx/blank_user_small.gif", "date": "2009-03-23", "user_name": "Michael T.", "id": "oia-XcRxPrqwx11GtCuw8Q"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/3loDhmkFIGyUQDATuo6e1Q/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4.png", "rating": 4, "mobile_uri": "http://mobile.yelp.com/biz/z_kf-vKkCLI1WTnEBSPudw?srid=Ez_hn7-Kor2EZ38lO37jMQ", "url": "http://www.yelp.com/biz/the-bar-at-the-four-seasons-san-francisco#hrid:Ez_hn7-Kor2EZ38lO37jMQ", "user_url": "http://www.yelp.com/user_details?userid=rdSJ_jlij_2x5glkrEEZxg", "text_excerpt": "My second favorite hotel cocktail bar! \n\nThe old man inside of me loves that I can go drink here with friends, meet a date, or even stop in for a proper...", "user_photo_url": "http://static.px.yelp.com/upthumb/3loDhmkFIGyUQDATuo6e1Q/ms", "date": "2009-03-15", "user_name": "Sean W.", "id": "Ez_hn7-Kor2EZ38lO37jMQ"}], "nearby_url": "http://www.yelp.com/search?find_loc=757+Market+St.%2C+San+Francisco%2C+CA+94103"}, {"rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4_half.png", "country_code": "US", "id": "QCQ3WN7hd9xMPs2_ycHa_A", "is_closed": false, "city": "San Francisco", "mobile_url": "http://mobile.yelp.com/biz/QCQ3WN7hd9xMPs2_ycHa_A", "review_count": 160, "zip": "94112", "state": "CA", "latitude": 37.714413999999998, "rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4_half.png", "address1": "1166 Geneva Ave", "address2": "", "address3": "", "phone": "4159631713", "state_code": "CA", "categories": [{"category_filter": "divebars", "search_url": "http://www.yelp.com/search?find_loc=1166+Geneva+Ave%2C+San+Francisco%2C+CA+94112&cflt=divebars", "name": "Dive Bars"}, {"category_filter": "soulfood", "search_url": "http://www.yelp.com/search?find_loc=1166+Geneva+Ave%2C+San+Francisco%2C+CA+94112&cflt=soulfood", "name": "Soul Food"}], "photo_url": "http://static.px.yelp.com/bpthumb/ANbY5m01ROgbtzteMQNIxw/ms", "distance": 4.2946634292602539, "name": "Broken Record", "neighborhoods": [], "url": "http://www.yelp.com/biz/broken-record-san-francisco", "country": "USA", "avg_rating": 4.5, "longitude": -122.43676000000001, "photo_url_small": "http://static.px.yelp.com/bpthumb/ANbY5m01ROgbtzteMQNIxw/ss", "reviews": [{"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/lLF6FjlIh_9itgOeqvjW6w/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/QCQ3WN7hd9xMPs2_ycHa_A?srid=0xMF-emnZXwMxpLdx7AmeQ", "url": "http://www.yelp.com/biz/broken-record-san-francisco#hrid:0xMF-emnZXwMxpLdx7AmeQ", "user_url": "http://www.yelp.com/user_details?userid=k4oMdCSDqa_1iP3hVaozZA", "text_excerpt": "Seriously, the food here is amazing. I recently tried out the smoked tofu sandwich! OMG, it is OFF THE CHIZZAIN!\n\nIt reminded me of a Bahn Mi aka Vietnamese...", "user_photo_url": "http://static.px.yelp.com/upthumb/lLF6FjlIh_9itgOeqvjW6w/ms", "date": "2009-04-16", "user_name": "Sheila S.", "id": "0xMF-emnZXwMxpLdx7AmeQ"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_3.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/5ZWqY4DRQ3X67uEbiFBv9Q/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_3.png", "rating": 3, "mobile_uri": "http://mobile.yelp.com/biz/QCQ3WN7hd9xMPs2_ycHa_A?srid=VZ50hhJuPJwjHF2t9UZ0HA", "url": "http://www.yelp.com/biz/broken-record-san-francisco#hrid:VZ50hhJuPJwjHF2t9UZ0HA", "user_url": "http://www.yelp.com/user_details?userid=P7_vx8jtm7tNz38N1H1NWw", "text_excerpt": "Yes, yes, I know -- when in the Excelsior, it's the only game in town, as R and I found out only too well tonight when we committed the unspeakable sin of...", "user_photo_url": "http://static.px.yelp.com/upthumb/5ZWqY4DRQ3X67uEbiFBv9Q/ms", "date": "2009-04-15", "user_name": "Chad P.", "id": "VZ50hhJuPJwjHF2t9UZ0HA"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/static/20090416/i/new/gfx/blank_user_extra_small.gif", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/QCQ3WN7hd9xMPs2_ycHa_A?srid=KA6C2DQShJhY4TQIT9Whbw", "url": "http://www.yelp.com/biz/broken-record-san-francisco#hrid:KA6C2DQShJhY4TQIT9Whbw", "user_url": "http://www.yelp.com/user_details?userid=fjNmLQcw2oSYhUASdlo27w", "text_excerpt": "You can expect all levels of comfort and excitement from the first and last time you come here. Meeting unforgettable people such as Bret (the lively, yet...", "user_photo_url": "http://static.px.yelp.com/static/20090416/i/new/gfx/blank_user_small.gif", "date": "2009-04-08", "user_name": "Kristoffer C.", "id": "KA6C2DQShJhY4TQIT9Whbw"}], "nearby_url": "http://www.yelp.com/search?find_loc=1166+Geneva+Ave%2C+San+Francisco%2C+CA+94112"}, {"rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4_half.png", "country_code": "US", "id": "kM64kcWiK3TqhB0HeAUGeg", "is_closed": false, "city": "San Francisco", "mobile_url": "http://mobile.yelp.com/biz/kM64kcWiK3TqhB0HeAUGeg", "review_count": 114, "zip": "94123", "state": "CA", "latitude": 37.798518000000001, "rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4_half.png", "address1": "1514 Union St", "address2": "", "address3": "", "phone": "4159282414", "state_code": "CA", "categories": [{"category_filter": "pubs", "search_url": "http://www.yelp.com/search?find_loc=1514+Union+St%2C+San+Francisco%2C+CA+94123&cflt=pubs", "name": "Pubs"}], "photo_url": "http://static.px.yelp.com/bpthumb/_Q0KPbKmAgQeLrcOgajjwA/ms", "distance": 1.6471928358078003, "name": "The Black Horse London Pub", "neighborhoods": [{"url": "http://www.yelp.com/search?find_loc=Marina%2FCow+Hollow%2C+San+Francisco%2C+CA", "name": "Marina/Cow Hollow"}], "url": "http://www.yelp.com/biz/the-black-horse-london-pub-san-francisco", "country": "USA", "avg_rating": 4.5, "longitude": -122.42431500000001, "photo_url_small": "http://static.px.yelp.com/bpthumb/_Q0KPbKmAgQeLrcOgajjwA/ss", "reviews": [{"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/vAKX9CLC4EJDm9X_YvP4WQ/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/kM64kcWiK3TqhB0HeAUGeg?srid=henYRKh-HFv-f0q25OrK-A", "url": "http://www.yelp.com/biz/the-black-horse-london-pub-san-francisco#hrid:henYRKh-HFv-f0q25OrK-A", "user_url": "http://www.yelp.com/user_details?userid=xZ1htr_9ZiOamddSoDWMqw", "text_excerpt": "Finding a place like this is why I am addicted to yelping. I am visiting the city for a conference and I wanted to find some local flavor and stay away...", "user_photo_url": "http://static.px.yelp.com/upthumb/vAKX9CLC4EJDm9X_YvP4WQ/ms", "date": "2009-04-18", "user_name": "Juliana M.", "id": "henYRKh-HFv-f0q25OrK-A"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_1.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/9s2WKYMKnCM4FwBLNTifyA/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_1.png", "rating": 1, "mobile_uri": "http://mobile.yelp.com/biz/kM64kcWiK3TqhB0HeAUGeg?srid=bwfzeVc_6gto9kFN_dXwZw", "url": "http://www.yelp.com/biz/the-black-horse-london-pub-san-francisco#hrid:bwfzeVc_6gto9kFN_dXwZw", "user_url": "http://www.yelp.com/user_details?userid=K1NLdTfT1IizE-6smhsSug", "text_excerpt": "REALLY??? I've been coming here for the last 8 or so years and I have never seen such a horrible sight before in such a beautiful place...PBR cans on the...", "user_photo_url": "http://static.px.yelp.com/upthumb/9s2WKYMKnCM4FwBLNTifyA/ms", "date": "2009-04-16", "user_name": "Creamy A.", "id": "bwfzeVc_6gto9kFN_dXwZw"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/wwoUpPp1AG2REqM-tONdYw/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4.png", "rating": 4, "mobile_uri": "http://mobile.yelp.com/biz/kM64kcWiK3TqhB0HeAUGeg?srid=Zau3gO0fZmnLrwf_MeDDVQ", "url": "http://www.yelp.com/biz/the-black-horse-london-pub-san-francisco#hrid:Zau3gO0fZmnLrwf_MeDDVQ", "user_url": "http://www.yelp.com/user_details?userid=dpEtyfB2o7MH1Mc_Ygoolg", "text_excerpt": "I came here for the first time last night and it's a really cool place. James was bartending and he's a really friendly guy. I tried the Kasteel Cru -- a...", "user_photo_url": "http://static.px.yelp.com/upthumb/wwoUpPp1AG2REqM-tONdYw/ms", "date": "2009-04-07", "user_name": "Aaron V.", "id": "Zau3gO0fZmnLrwf_MeDDVQ"}], "nearby_url": "http://www.yelp.com/search?find_loc=1514+Union+St%2C+San+Francisco%2C+CA+94123"}, {"rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4_half.png", "country_code": "US", "id": "5Ebc8-ecaLuaLDjKnmY7eg", "is_closed": false, "city": "San Francisco", "mobile_url": "http://mobile.yelp.com/biz/5Ebc8-ecaLuaLDjKnmY7eg", "review_count": 43, "zip": "94109", "state": "CA", "latitude": 37.79712, "rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4_half.png", "address1": "2211 Polk St", "address2": "", "address3": "", "phone": "4156732211", "state_code": "CA", "categories": [{"category_filter": "divebars", "search_url": "http://www.yelp.com/search?find_loc=2211+Polk+St%2C+San+Francisco%2C+CA+94109&cflt=divebars", "name": "Dive Bars"}], "photo_url": "http://static.px.yelp.com/bpthumb/IXDxbdklFZPJOHHM2rSzVw/ms", "distance": 1.5348267555236816, "name": "Cresta's Twenty Two Eleven Club", "neighborhoods": [{"url": "http://www.yelp.com/search?find_loc=Russian+Hill%2C+San+Francisco%2C+CA", "name": "Russian Hill"}], "url": "http://www.yelp.com/biz/crestas-twenty-two-eleven-club-san-francisco", "country": "USA", "avg_rating": 4.5, "longitude": -122.42204099999999, "photo_url_small": "http://static.px.yelp.com/bpthumb/IXDxbdklFZPJOHHM2rSzVw/ss", "reviews": [{"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_1.png", "user_photo_url_small": "http://static.px.yelp.com/static/20090416/i/new/gfx/blank_user_extra_small.gif", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_1.png", "rating": 1, "mobile_uri": "http://mobile.yelp.com/biz/5Ebc8-ecaLuaLDjKnmY7eg?srid=PLzThYFVEqlMWIp1j8FVjA", "url": "http://www.yelp.com/biz/crestas-twenty-two-eleven-club-san-francisco#hrid:PLzThYFVEqlMWIp1j8FVjA", "user_url": "http://www.yelp.com/user_details?userid=QmmdnVRrxAZLm76-8OTD7Q", "text_excerpt": "The youngish female bartender is a bitch!", "user_photo_url": "http://static.px.yelp.com/static/20090416/i/new/gfx/blank_user_small.gif", "date": "2009-04-02", "user_name": "Adrian B.", "id": "PLzThYFVEqlMWIp1j8FVjA"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/iAufJ9qyXdH0n36yWkOCag/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4.png", "rating": 4, "mobile_uri": "http://mobile.yelp.com/biz/5Ebc8-ecaLuaLDjKnmY7eg?srid=EsRVbt4a0PVZLVQJcqslwg", "url": "http://www.yelp.com/biz/crestas-twenty-two-eleven-club-san-francisco#hrid:EsRVbt4a0PVZLVQJcqslwg", "user_url": "http://www.yelp.com/user_details?userid=1D5EQITb4hOzPMZT8gDPQQ", "text_excerpt": "This place kind of makes me laugh, probably because I never would have known how it existed until I discovered it in a pretty unusual way... So I was...", "user_photo_url": "http://static.px.yelp.com/upthumb/iAufJ9qyXdH0n36yWkOCag/ms", "date": "2009-02-08", "user_name": "Krista S.", "id": "EsRVbt4a0PVZLVQJcqslwg"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/S1x1MObQYQTRCrcxwal8Dw/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4.png", "rating": 4, "mobile_uri": "http://mobile.yelp.com/biz/5Ebc8-ecaLuaLDjKnmY7eg?srid=Bzq9fk2KAlSDNJYoYZwzSA", "url": "http://www.yelp.com/biz/crestas-twenty-two-eleven-club-san-francisco#hrid:Bzq9fk2KAlSDNJYoYZwzSA", "user_url": "http://www.yelp.com/user_details?userid=xADAW32u15sgA18Hfy9PsQ", "text_excerpt": "where everybody knows your name.\n\nwell, they're not mindreaders... so they don't know your name cause you haven't been there. if you have been there, then...", "user_photo_url": "http://static.px.yelp.com/upthumb/S1x1MObQYQTRCrcxwal8Dw/ms", "date": "2009-01-19", "user_name": "Kevin F.", "id": "Bzq9fk2KAlSDNJYoYZwzSA"}], "nearby_url": "http://www.yelp.com/search?find_loc=2211+Polk+St%2C+San+Francisco%2C+CA+94109"}, {"rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4_half.png", "country_code": "US", "id": "3K82F5PA3OSU8-LzWDfgHg", "is_closed": false, "city": "San Francisco", "mobile_url": "http://mobile.yelp.com/biz/3K82F5PA3OSU8-LzWDfgHg", "review_count": 138, "zip": "94110", "state": "CA", "latitude": 37.739147000000003, "rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4_half.png", "address1": "424 Cortland Ave", "address2": "", "address3": "", "phone": "4156473099", "state_code": "CA", "categories": [{"category_filter": "gaybars", "search_url": "http://www.yelp.com/search?find_loc=424+Cortland+Ave%2C+San+Francisco%2C+CA+94110&cflt=gaybars", "name": "Gay Bars"}, {"category_filter": "divebars", "search_url": "http://www.yelp.com/search?find_loc=424+Cortland+Ave%2C+San+Francisco%2C+CA+94110&cflt=divebars", "name": "Dive Bars"}], "photo_url": "http://static.px.yelp.com/bpthumb/zYyt2w6e_gBAOmIVBUqRPA/ms", "distance": 2.4808199405670166, "name": "Wild Side West", "neighborhoods": [{"url": "http://www.yelp.com/search?find_loc=Bernal+Heights%2C+San+Francisco%2C+CA", "name": "Bernal Heights"}], "url": "http://www.yelp.com/biz/wild-side-west-san-francisco", "country": "USA", "avg_rating": 4.5, "longitude": -122.41716, "photo_url_small": "http://static.px.yelp.com/bpthumb/zYyt2w6e_gBAOmIVBUqRPA/ss", "reviews": [{"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/l80OO5ruhFcYFiUjNX-Y9w/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4.png", "rating": 4, "mobile_uri": "http://mobile.yelp.com/biz/3K82F5PA3OSU8-LzWDfgHg?srid=qfBP6DYib_Jq97XZdSKqRg", "url": "http://www.yelp.com/biz/wild-side-west-san-francisco#hrid:qfBP6DYib_Jq97XZdSKqRg", "user_url": "http://www.yelp.com/user_details?userid=IUEkE8T7SvEw4LXSWSOknw", "text_excerpt": "This place is fun if you want to go and chill and have a conversation. Say...for a first date. I recommend going early (so maybe a place to go before you...", "user_photo_url": "http://static.px.yelp.com/upthumb/l80OO5ruhFcYFiUjNX-Y9w/ms", "date": "2009-04-15", "user_name": "Heather S.", "id": "qfBP6DYib_Jq97XZdSKqRg"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/static/20090416/i/new/gfx/blank_user_extra_small.gif", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/3K82F5PA3OSU8-LzWDfgHg?srid=sZcTfRdns9N9o6rsCbmEqA", "url": "http://www.yelp.com/biz/wild-side-west-san-francisco#hrid:sZcTfRdns9N9o6rsCbmEqA", "user_url": "http://www.yelp.com/user_details?userid=_Dv1gLCvRlrLTxxP5TX8GA", "text_excerpt": "Wild Side has a great vibe. Been going there for years and love the outdoor spaces, particularly the back patio in the afternoon on a sunny day. The...", "user_photo_url": "http://static.px.yelp.com/static/20090416/i/new/gfx/blank_user_small.gif", "date": "2009-04-06", "user_name": "Armand C.", "id": "sZcTfRdns9N9o6rsCbmEqA"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_3.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/bxtZFTMp6Lib0xWcVNywwQ/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_3.png", "rating": 3, "mobile_uri": "http://mobile.yelp.com/biz/3K82F5PA3OSU8-LzWDfgHg?srid=t6CLo9DTqlAB1WQ0xGBwKw", "url": "http://www.yelp.com/biz/wild-side-west-san-francisco#hrid:t6CLo9DTqlAB1WQ0xGBwKw", "user_url": "http://www.yelp.com/user_details?userid=9-y579gMphAItFxc9XA8yQ", "text_excerpt": "I like this place enough - it has a nice backyard.\n\nBut sometimes you never know what you're going to get here. I went here for my birthday last year and...", "user_photo_url": "http://static.px.yelp.com/upthumb/bxtZFTMp6Lib0xWcVNywwQ/ms", "date": "2009-04-05", "user_name": "Whitney D.", "id": "t6CLo9DTqlAB1WQ0xGBwKw"}], "nearby_url": "http://www.yelp.com/search?find_loc=424+Cortland+Ave%2C+San+Francisco%2C+CA+94110"}, {"rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4_half.png", "country_code": "US", "id": "GTy7Up0mCTDoYpu0gLsUOQ", "is_closed": false, "city": "San Francisco", "mobile_url": "http://mobile.yelp.com/biz/GTy7Up0mCTDoYpu0gLsUOQ", "review_count": 61, "zip": "94109", "state": "CA", "latitude": 37.7864990234375, "rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4_half.png", "address1": "768 Geary Street", "address2": "", "address3": "", "phone": "4154419336", "state_code": "CA", "categories": [{"category_filter": "divebars", "search_url": "http://www.yelp.com/search?find_loc=768+Geary+Street%2C+San+Francisco%2C+CA+94109&cflt=divebars", "name": "Dive Bars"}], "photo_url": "http://static.px.yelp.com/bpthumb/1aK0JUrH9QLrmn76RnlxNA/ms", "distance": 0.81350231170654297, "name": "Geary Club", "neighborhoods": [{"url": "http://www.yelp.com/search?find_loc=Civic+Center%2FTenderloin%2C+San+Francisco%2C+CA", "name": "Civic Center/Tenderloin"}, {"url": "http://www.yelp.com/search?find_loc=Nob+Hill%2C+San+Francisco%2C+CA", "name": "Nob Hill"}], "url": "http://www.yelp.com/biz/geary-club-san-francisco", "country": "USA", "avg_rating": 4.5, "longitude": -122.41600036621099, "photo_url_small": "http://static.px.yelp.com/bpthumb/1aK0JUrH9QLrmn76RnlxNA/ss", "reviews": [{"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_3.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/vAKX9CLC4EJDm9X_YvP4WQ/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_3.png", "rating": 3, "mobile_uri": "http://mobile.yelp.com/biz/GTy7Up0mCTDoYpu0gLsUOQ?srid=3BF5IQWRCa5kE4CG66O7lg", "url": "http://www.yelp.com/biz/geary-club-san-francisco#hrid:3BF5IQWRCa5kE4CG66O7lg", "user_url": "http://www.yelp.com/user_details?userid=xZ1htr_9ZiOamddSoDWMqw", "text_excerpt": "if you like dives you will like the Geary Club. Not only is there a fake stuffed tiger head front and center, but bartender I had didn't seem to know how...", "user_photo_url": "http://static.px.yelp.com/upthumb/vAKX9CLC4EJDm9X_YvP4WQ/ms", "date": "2009-04-18", "user_name": "Juliana M.", "id": "3BF5IQWRCa5kE4CG66O7lg"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/_naF53nRZT9HYVeplcX5Hg/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/GTy7Up0mCTDoYpu0gLsUOQ?srid=7WfO0LKgRp0Tl_C-Zf-D4Q", "url": "http://www.yelp.com/biz/geary-club-san-francisco#hrid:7WfO0LKgRp0Tl_C-Zf-D4Q", "user_url": "http://www.yelp.com/user_details?userid=JF-7fBtuA_l5R650Iqe7RQ", "text_excerpt": "I still love Geary Club and Lillian! I kinda like it when a bartender isnt afraid to down a few drinks while working and also make some weird tv dinner for...", "user_photo_url": "http://static.px.yelp.com/upthumb/_naF53nRZT9HYVeplcX5Hg/ms", "date": "2009-03-08", "user_name": "jen d.", "id": "7WfO0LKgRp0Tl_C-Zf-D4Q"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/gdb2pU0wnmsXjAlo_skMgg/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/GTy7Up0mCTDoYpu0gLsUOQ?srid=fwBDJyffi2muLlxF5gRgFQ", "url": "http://www.yelp.com/biz/geary-club-san-francisco#hrid:fwBDJyffi2muLlxF5gRgFQ", "user_url": "http://www.yelp.com/user_details?userid=Sw4e9geYXjwG8-JgsuZTSw", "text_excerpt": "Finally I made it to Geary Club!\n\nA rainy Monday night after having a weird \"building party\" at my house.\nI was already a bit drunk and the Geary Club was...", "user_photo_url": "http://static.px.yelp.com/upthumb/gdb2pU0wnmsXjAlo_skMgg/ms", "date": "2009-02-25", "user_name": "cecilia b.", "id": "fwBDJyffi2muLlxF5gRgFQ"}], "nearby_url": "http://www.yelp.com/search?find_loc=768+Geary+Street%2C+San+Francisco%2C+CA+94109"}, {"rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4_half.png", "country_code": "US", "id": "vDdJPPRT4_6TociAEHJvgw", "is_closed": false, "city": "San Francisco", "mobile_url": "http://mobile.yelp.com/biz/vDdJPPRT4_6TociAEHJvgw", "review_count": 23, "zip": "94117", "state": "CA", "latitude": 37.776829900000003, "rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4_half.png", "address1": "1304 Fulton Street", "address2": "", "address3": "", "phone": "4155676503", "state_code": "CA", "categories": [{"category_filter": "wine_bars", "search_url": "http://www.yelp.com/search?find_loc=1304+Fulton+Street%2C+San+Francisco%2C+CA+94117&cflt=wine_bars", "name": "Wine Bars"}, {"category_filter": "beer_and_wine", "search_url": "http://www.yelp.com/search?find_loc=1304+Fulton+Street%2C+San+Francisco%2C+CA+94117&cflt=beer_and_wine", "name": "Beer, Wine & Spirits"}], "photo_url": "http://static.px.yelp.com/bpthumb/TRFnGi4Dk5XYkX38KMQ_Uw/ms", "distance": 1.0542008876800537, "name": "Corkage Sake and Wine Shop", "neighborhoods": [{"url": "http://www.yelp.com/search?find_loc=Western+Addition%2FNOPA%2C+San+Francisco%2C+CA", "name": "Western Addition/NOPA"}], "url": "http://www.yelp.com/biz/corkage-sake-and-wine-shop-san-francisco", "country": "USA", "avg_rating": 4.5, "longitude": -122.4384484, "photo_url_small": "http://static.px.yelp.com/bpthumb/TRFnGi4Dk5XYkX38KMQ_Uw/ss", "reviews": [{"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/static/20090416/i/new/gfx/blank_user_extra_small.gif", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/vDdJPPRT4_6TociAEHJvgw?srid=qR9gfXBG2bAI--ffudbb8g", "url": "http://www.yelp.com/biz/corkage-sake-and-wine-shop-san-francisco#hrid:qR9gfXBG2bAI--ffudbb8g", "user_url": "http://www.yelp.com/user_details?userid=NRGUOpoK1RvIUWZPQ13QTg", "text_excerpt": "I'm just getting into writing reviews but I feel I'd be remiss if i didn't write a review for one of my favorite spots in town. Even though it scares me...", "user_photo_url": "http://static.px.yelp.com/static/20090416/i/new/gfx/blank_user_small.gif", "date": "2009-04-03", "user_name": "ezra d.", "id": "qR9gfXBG2bAI--ffudbb8g"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/JiWacKWw01QjoL3Kqz-gYQ/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/vDdJPPRT4_6TociAEHJvgw?srid=v-TypFJpjx3sI5imG3muHg", "url": "http://www.yelp.com/biz/corkage-sake-and-wine-shop-san-francisco#hrid:v-TypFJpjx3sI5imG3muHg", "user_url": "http://www.yelp.com/user_details?userid=LIr-srYm2nOmPlXQxaYELQ", "text_excerpt": "Yoshi rocks!\nHe is sooo cool! and finds the right sake for you. \nI got my 'Happy Bride'!\n\nthank you Yoshi for such a wonderful time! =)", "user_photo_url": "http://static.px.yelp.com/upthumb/JiWacKWw01QjoL3Kqz-gYQ/ms", "date": "2009-03-27", "user_name": "Daniela D.", "id": "v-TypFJpjx3sI5imG3muHg"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/2whWATS5zogQQcAX-gGRGQ/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4.png", "rating": 4, "mobile_uri": "http://mobile.yelp.com/biz/vDdJPPRT4_6TociAEHJvgw?srid=zS2Q_jRPYnSvApjcJnERbg", "url": "http://www.yelp.com/biz/corkage-sake-and-wine-shop-san-francisco#hrid:zS2Q_jRPYnSvApjcJnERbg", "user_url": "http://www.yelp.com/user_details?userid=uTSGqJGFwngSLTSckILesw", "text_excerpt": "this is a great spot for wine or sake. well, for me, mainly wine :)\n\nthey have a pretty decent selection of wines ranging from $15-45, however there are...", "user_photo_url": "http://static.px.yelp.com/upthumb/2whWATS5zogQQcAX-gGRGQ/ms", "date": "2009-02-26", "user_name": "Kandace J.", "id": "zS2Q_jRPYnSvApjcJnERbg"}], "nearby_url": "http://www.yelp.com/search?find_loc=1304+Fulton+Street%2C+San+Francisco%2C+CA+94117"}, {"rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4_half.png", "country_code": "US", "id": "vqIWlQ0AHMFBOiagpB9sGw", "is_closed": false, "city": "San Francisco", "mobile_url": "http://mobile.yelp.com/biz/vqIWlQ0AHMFBOiagpB9sGw", "review_count": 43, "zip": "94122", "state": "CA", "latitude": 37.754299163818402, "rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4_half.png", "address1": "1232 Noriega Street", "address2": "", "address3": "", "phone": "4156610166", "state_code": "CA", "categories": [{"category_filter": "divebars", "search_url": "http://www.yelp.com/search?find_loc=1232+Noriega+Street%2C+San+Francisco%2C+CA+94122&cflt=divebars", "name": "Dive Bars"}], "photo_url": "http://static.px.yelp.com/bpthumb/nD2x6wclDBcaSd6ftQOl8A/ms", "distance": 3.4622526168823242, "name": "Eagle's Drift In Lounge", "neighborhoods": [{"url": "http://www.yelp.com/search?find_loc=Outer+Sunset%2C+San+Francisco%2C+CA", "name": "Outer Sunset"}], "url": "http://www.yelp.com/biz/eagles-drift-in-lounge-san-francisco", "country": "USA", "avg_rating": 4.5, "longitude": -122.476997375488, "photo_url_small": "http://static.px.yelp.com/bpthumb/nD2x6wclDBcaSd6ftQOl8A/ss", "reviews": [{"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_3.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/Fz-tRBmSVG8i1Dm6s-Q0yA/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_3.png", "rating": 3, "mobile_uri": "http://mobile.yelp.com/biz/vqIWlQ0AHMFBOiagpB9sGw?srid=nRaORNVURLfU32LijX-fOg", "url": "http://www.yelp.com/biz/eagles-drift-in-lounge-san-francisco#hrid:nRaORNVURLfU32LijX-fOg", "user_url": "http://www.yelp.com/user_details?userid=hE34xpG35WugHznWf79HfQ", "text_excerpt": "For a bar that seems serious about their darts I have not been in here a single time when anyone is playing them. Which is a good thing, because I would...", "user_photo_url": "http://static.px.yelp.com/upthumb/Fz-tRBmSVG8i1Dm6s-Q0yA/ms", "date": "2009-04-17", "user_name": "Drue C.", "id": "nRaORNVURLfU32LijX-fOg"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/UdPPgUlMb2DYpxQI3L-xAg/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/vqIWlQ0AHMFBOiagpB9sGw?srid=2e-Y3tM2mbL8XmNSrKvOFg", "url": "http://www.yelp.com/biz/eagles-drift-in-lounge-san-francisco#hrid:2e-Y3tM2mbL8XmNSrKvOFg", "user_url": "http://www.yelp.com/user_details?userid=zvAZsfg7Id2c9X5Vx8uMvQ", "text_excerpt": "When it comes to bars, I like it empty and almost having the place all to myself and with my friends. This place is great because it is a great place to...", "user_photo_url": "http://static.px.yelp.com/upthumb/UdPPgUlMb2DYpxQI3L-xAg/ms", "date": "2009-03-18", "user_name": "Christina W.", "id": "2e-Y3tM2mbL8XmNSrKvOFg"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/-3EK3uAM0q8SkB9uJCKLtw/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/vqIWlQ0AHMFBOiagpB9sGw?srid=I53XvaUKFN8CirxYnFLPdQ", "url": "http://www.yelp.com/biz/eagles-drift-in-lounge-san-francisco#hrid:I53XvaUKFN8CirxYnFLPdQ", "user_url": "http://www.yelp.com/user_details?userid=smx4hf_nkWhFklxLwfGLjw", "text_excerpt": "The first time I came here we walked in at about 9 or 10 on a Saturday night and there wasn't a soul in sight--not even a bartender--and the placed smelled...", "user_photo_url": "http://static.px.yelp.com/upthumb/-3EK3uAM0q8SkB9uJCKLtw/ms", "date": "2009-01-10", "user_name": "Trav W.", "id": "I53XvaUKFN8CirxYnFLPdQ"}], "nearby_url": "http://www.yelp.com/search?find_loc=1232+Noriega+Street%2C+San+Francisco%2C+CA+94122"}, {"rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4_half.png", "country_code": "US", "id": "rDlZHmGNnbBQWf-Ujfc2KA", "is_closed": false, "city": "San Francisco", "mobile_url": "http://mobile.yelp.com/biz/rDlZHmGNnbBQWf-Ujfc2KA", "review_count": 126, "zip": "94122", "state": "CA", "latitude": 37.763401031494098, "rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4_half.png", "address1": "2328 Irving Street", "address2": "", "address3": "", "phone": "4156642555", "state_code": "CA", "categories": [{"category_filter": "pubs", "search_url": "http://www.yelp.com/search?find_loc=2328+Irving+Street%2C+San+Francisco%2C+CA+94122&cflt=pubs", "name": "Pubs"}, {"category_filter": "irish", "search_url": "http://www.yelp.com/search?find_loc=2328+Irving+Street%2C+San+Francisco%2C+CA+94122&cflt=irish", "name": "Irish"}], "photo_url": "http://static.px.yelp.com/bpthumb/TSwz87bjS4THX5X8W8kffA/ms", "distance": 3.5711524486541748, "name": "Durty Nelly's", "neighborhoods": [{"url": "http://www.yelp.com/search?find_loc=Outer+Sunset%2C+San+Francisco%2C+CA", "name": "Outer Sunset"}], "url": "http://www.yelp.com/biz/durty-nellys-san-francisco", "country": "USA", "avg_rating": 4.5, "longitude": -122.48300170898401, "photo_url_small": "http://static.px.yelp.com/bpthumb/TSwz87bjS4THX5X8W8kffA/ss", "reviews": [{"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/static/20090416/i/new/gfx/blank_user_extra_small.gif", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/rDlZHmGNnbBQWf-Ujfc2KA?srid=zAr0i4_-Yvx3bMhAHxtRww", "url": "http://www.yelp.com/biz/durty-nellys-san-francisco#hrid:zAr0i4_-Yvx3bMhAHxtRww", "user_url": "http://www.yelp.com/user_details?userid=fYWW7lFdHcvUJ-gsTRJttw", "text_excerpt": "This place is the Shiznack!", "user_photo_url": "http://static.px.yelp.com/static/20090416/i/new/gfx/blank_user_small.gif", "date": "2009-04-07", "user_name": "shoo b.", "id": "zAr0i4_-Yvx3bMhAHxtRww"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/PBwngRvnIdtYIy9iF3tbbQ/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4.png", "rating": 4, "mobile_uri": "http://mobile.yelp.com/biz/rDlZHmGNnbBQWf-Ujfc2KA?srid=3w_awDdrGBWsJVpu8Cg8Kg", "url": "http://www.yelp.com/biz/durty-nellys-san-francisco#hrid:3w_awDdrGBWsJVpu8Cg8Kg", "user_url": "http://www.yelp.com/user_details?userid=RbaIxpAbwl6JrIPgIX4XIw", "text_excerpt": "I love Durty's!!! Not only is it a rad and pretty authentic Irish bar, but it has amazing food too! Bangers and mash, chicken pot pie, and an EXCELLENT...", "user_photo_url": "http://static.px.yelp.com/upthumb/PBwngRvnIdtYIy9iF3tbbQ/ms", "date": "2009-04-01", "user_name": "Jamie J.", "id": "3w_awDdrGBWsJVpu8Cg8Kg"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4.png", "user_photo_url_small": "http://static.px.yelp.com/static/20090416/i/new/gfx/blank_user_extra_small.gif", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4.png", "rating": 4, "mobile_uri": "http://mobile.yelp.com/biz/rDlZHmGNnbBQWf-Ujfc2KA?srid=CNIUSa4Os71fVYOk8Tu0lA", "url": "http://www.yelp.com/biz/durty-nellys-san-francisco#hrid:CNIUSa4Os71fVYOk8Tu0lA", "user_url": "http://www.yelp.com/user_details?userid=zlxg7BQ6StisAAC0cpUsZQ", "text_excerpt": "If this place was closer to where I live, I think I might go here once a week. A great little Irish pub. They pour a perfect Guinness. I had the...", "user_photo_url": "http://static.px.yelp.com/static/20090416/i/new/gfx/blank_user_small.gif", "date": "2009-03-22", "user_name": "Luke P.", "id": "CNIUSa4Os71fVYOk8Tu0lA"}], "nearby_url": "http://www.yelp.com/search?find_loc=2328+Irving+Street%2C+San+Francisco%2C+CA+94122"}, {"rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4_half.png", "country_code": "US", "id": "c7BkLCKjHjIg7oS63LsI1Q", "is_closed": false, "city": "San Francisco", "mobile_url": "http://mobile.yelp.com/biz/c7BkLCKjHjIg7oS63LsI1Q", "review_count": 47, "zip": "94114", "state": "CA", "latitude": 37.759743, "rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4_half.png", "address1": "572 Castro St", "address2": "", "address3": "", "phone": "4158642262", "state_code": "CA", "categories": [{"category_filter": "beer_and_wine", "search_url": "http://www.yelp.com/search?find_loc=572+Castro+St%2C+San+Francisco%2C+CA+94114&cflt=beer_and_wine", "name": "Beer, Wine & Spirits"}, {"category_filter": "wine_bars", "search_url": "http://www.yelp.com/search?find_loc=572+Castro+St%2C+San+Francisco%2C+CA+94114&cflt=wine_bars", "name": "Wine Bars"}], "photo_url": "http://static.px.yelp.com/bpthumb/i7c6kns-SbJj6xe6Uy_34A/ms", "distance": 1.3577183485031128, "name": "Swirl on Castro", "neighborhoods": [{"url": "http://www.yelp.com/search?find_loc=Castro%2C+San+Francisco%2C+CA", "name": "Castro"}], "url": "http://www.yelp.com/biz/swirl-on-castro-san-francisco", "country": "USA", "avg_rating": 4.5, "longitude": -122.434932, "photo_url_small": "http://static.px.yelp.com/bpthumb/i7c6kns-SbJj6xe6Uy_34A/ss", "reviews": [{"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/x0-s9hvClAZWTTbvm-A_Hg/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/c7BkLCKjHjIg7oS63LsI1Q?srid=V0CDM76r13GbsFBujh5tSg", "url": "http://www.yelp.com/biz/swirl-on-castro-san-francisco#hrid:V0CDM76r13GbsFBujh5tSg", "user_url": "http://www.yelp.com/user_details?userid=9hJYqwXzjbLsw_WUqYyzMg", "text_excerpt": "Here's an update since I went back last night - Thanks Jerry for a great time. You and your staff... Kelly, Josh and Kenny's Twin (sorry I forgot your name)...", "user_photo_url": "http://static.px.yelp.com/upthumb/x0-s9hvClAZWTTbvm-A_Hg/ms", "date": "2009-03-20", "user_name": "Jodi B.", "id": "V0CDM76r13GbsFBujh5tSg"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_3.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/hspGLwRANroWkFZutDcO4w/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_3.png", "rating": 3, "mobile_uri": "http://mobile.yelp.com/biz/c7BkLCKjHjIg7oS63LsI1Q?srid=f2EFPOtE2cWlwKwOyyUZuQ", "url": "http://www.yelp.com/biz/swirl-on-castro-san-francisco#hrid:f2EFPOtE2cWlwKwOyyUZuQ", "user_url": "http://www.yelp.com/user_details?userid=uSCYNal_CJDPGBYUAenyoA", "text_excerpt": "From the outside it's easy to get the impression that if Melissa Rivers married one of the Alitos and started a wine label to keep busy, this is where the...", "user_photo_url": "http://static.px.yelp.com/upthumb/hspGLwRANroWkFZutDcO4w/ms", "date": "2009-03-18", "user_name": "Luke M.", "id": "f2EFPOtE2cWlwKwOyyUZuQ"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/wwRGU_D9-Ajfs1mwko-nlw/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/c7BkLCKjHjIg7oS63LsI1Q?srid=FR6vaLqh-MvXUAO1AHGHXQ", "url": "http://www.yelp.com/biz/swirl-on-castro-san-francisco#hrid:FR6vaLqh-MvXUAO1AHGHXQ", "user_url": "http://www.yelp.com/user_details?userid=V8t5zmkH-o5IHmKeds6DuA", "text_excerpt": "Great store with wine tasting bar. Nice alternative from the \"meat market\" bars in the Castro. Great place to hang with friends before or after dinner....", "user_photo_url": "http://static.px.yelp.com/upthumb/wwRGU_D9-Ajfs1mwko-nlw/ms", "date": "2009-03-17", "user_name": "Danny B.", "id": "FR6vaLqh-MvXUAO1AHGHXQ"}], "nearby_url": "http://www.yelp.com/search?find_loc=572+Castro+St%2C+San+Francisco%2C+CA+94114"}, {"rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4_half.png", "country_code": "US", "id": "qxaYckrMuYu1PugSY1njzA", "is_closed": false, "city": "San Francisco", "mobile_url": "http://mobile.yelp.com/biz/qxaYckrMuYu1PugSY1njzA", "review_count": 190, "zip": "94107", "state": "CA", "latitude": 37.758201599121101, "rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4_half.png", "address1": "2490 3rd St", "address2": "", "address3": "", "phone": "4154018984", "state_code": "CA", "categories": [{"category_filter": "wine_bars", "search_url": "http://www.yelp.com/search?find_loc=2490+3rd+St%2C+San+Francisco%2C+CA+94107&cflt=wine_bars", "name": "Wine Bars"}], "photo_url": "http://static.px.yelp.com/bpthumb/vX704tjDFSzctwRTE5oaEA/ms", "distance": 2.021336555480957, "name": "Yield Wine Bar", "neighborhoods": [{"url": "http://www.yelp.com/search?find_loc=Dogpatch%2C+San+Francisco%2C+CA", "name": "Dogpatch"}, {"url": "http://www.yelp.com/search?find_loc=Potrero+Hill%2C+San+Francisco%2C+CA", "name": "Potrero Hill"}], "url": "http://www.yelp.com/biz/yield-wine-bar-san-francisco", "country": "USA", "avg_rating": 4.5, "longitude": -122.388999938965, "photo_url_small": "http://static.px.yelp.com/bpthumb/vX704tjDFSzctwRTE5oaEA/ss", "reviews": [{"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/t4zvXYHqYmm-QW0-Te2j1g/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4.png", "rating": 4, "mobile_uri": "http://mobile.yelp.com/biz/qxaYckrMuYu1PugSY1njzA?srid=E_DBJLUf03v8nzUDML-vIQ", "url": "http://www.yelp.com/biz/yield-wine-bar-san-francisco#hrid:E_DBJLUf03v8nzUDML-vIQ", "user_url": "http://www.yelp.com/user_details?userid=UBAfc-KuDXV8XLurou_i6g", "text_excerpt": "Really enjoyed this place. Nice selection of wine, smaller venue great for just catching up w/a friend or two over a drink. Some great bites to nosh on too....", "user_photo_url": "http://static.px.yelp.com/upthumb/t4zvXYHqYmm-QW0-Te2j1g/ms", "date": "2009-04-17", "user_name": "Abby W.", "id": "E_DBJLUf03v8nzUDML-vIQ"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/NR3YhAUjzQ4SZgkg6vqheA/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4.png", "rating": 4, "mobile_uri": "http://mobile.yelp.com/biz/qxaYckrMuYu1PugSY1njzA?srid=ukTS7oSTJ9jLZwX32JBVpA", "url": "http://www.yelp.com/biz/yield-wine-bar-san-francisco#hrid:ukTS7oSTJ9jLZwX32JBVpA", "user_url": "http://www.yelp.com/user_details?userid=Fnw_f0X0-cBscRr4sX5JYg", "text_excerpt": "Great find, a friend of mine suggested this place and I most say it was a great find, the wine selection is accompanied by a wonderful description, the...", "user_photo_url": "http://static.px.yelp.com/upthumb/NR3YhAUjzQ4SZgkg6vqheA/ms", "date": "2009-04-15", "user_name": "Emmy B.", "id": "ukTS7oSTJ9jLZwX32JBVpA"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/Ig55RB3mMzhZoptC6kJtPA/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/qxaYckrMuYu1PugSY1njzA?srid=5ti4DbCQHC0Jv0BICzMqoA", "url": "http://www.yelp.com/biz/yield-wine-bar-san-francisco#hrid:5ti4DbCQHC0Jv0BICzMqoA", "user_url": "http://www.yelp.com/user_details?userid=d7RGLy5EPXEFpLAfh3uwvA", "text_excerpt": "I almost don't want to write this review. Yield is a rare gem and I don't want everyone and their brother stealing all the seats! 100 words or less:...", "user_photo_url": "http://static.px.yelp.com/upthumb/Ig55RB3mMzhZoptC6kJtPA/ms", "date": "2009-04-12", "user_name": "Meadow L.", "id": "5ti4DbCQHC0Jv0BICzMqoA"}], "nearby_url": "http://www.yelp.com/search?find_loc=2490+3rd+St%2C+San+Francisco%2C+CA+94107"}, {"rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4_half.png", "country_code": "US", "id": "7-dAb6BdjgJE_KHTX9CNGA", "is_closed": false, "city": "San Francisco", "mobile_url": "http://mobile.yelp.com/biz/7-dAb6BdjgJE_KHTX9CNGA", "review_count": 54, "zip": "94133", "state": "CA", "latitude": 37.804698944091797, "rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4_half.png", "address1": "475 Francisco Street", "address2": "", "address3": "", "phone": "4154332343", "state_code": "CA", "categories": [{"category_filter": "lounges", "search_url": "http://www.yelp.com/search?find_loc=475+Francisco+Street%2C+San+Francisco%2C+CA+94133&cflt=lounges", "name": "Lounges"}], "photo_url": "http://static.px.yelp.com/bpthumb/uooIx_I_pm2PwbBOcDTRuw/ms", "distance": 2.0795242786407471, "name": "Sweeties", "neighborhoods": [{"url": "http://www.yelp.com/search?find_loc=North+Beach%2FTelegraph+Hill%2C+San+Francisco%2C+CA", "name": "North Beach/Telegraph Hill"}], "url": "http://www.yelp.com/biz/sweeties-san-francisco", "country": "USA", "avg_rating": 4.5, "longitude": -122.41300201416, "photo_url_small": "http://static.px.yelp.com/bpthumb/uooIx_I_pm2PwbBOcDTRuw/ss", "reviews": [{"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/gy2uwuDpWj8mnewYVCWVVw/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/7-dAb6BdjgJE_KHTX9CNGA?srid=6RoFwO-RdkMW6YqeORQFPw", "url": "http://www.yelp.com/biz/sweeties-san-francisco#hrid:6RoFwO-RdkMW6YqeORQFPw", "user_url": "http://www.yelp.com/user_details?userid=Vnja4xoPVQ7BLXIsVy_cFw", "text_excerpt": "Perfect place for a get together if you need a back room to yourselves. Pizza was delish. I'm glad we went. Cozy and charming and edgy all at the same time.", "user_photo_url": "http://static.px.yelp.com/upthumb/gy2uwuDpWj8mnewYVCWVVw/ms", "date": "2009-03-15", "user_name": "Amy J.", "id": "6RoFwO-RdkMW6YqeORQFPw"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/U7VW_Q_ITvOx-_oV5ThIhg/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4.png", "rating": 4, "mobile_uri": "http://mobile.yelp.com/biz/7-dAb6BdjgJE_KHTX9CNGA?srid=6AEH1ho2sFA6SuzGoEDWMg", "url": "http://www.yelp.com/biz/sweeties-san-francisco#hrid:6AEH1ho2sFA6SuzGoEDWMg", "user_url": "http://www.yelp.com/user_details?userid=e1FuiYSV1v29q2OTR9ojBA", "text_excerpt": "You would probably NEVER know there was a bar here, unless you were in the neighborhood all the time. I thought I knew where almost every bar was in North...", "user_photo_url": "http://static.px.yelp.com/upthumb/U7VW_Q_ITvOx-_oV5ThIhg/ms", "date": "2009-03-01", "user_name": "Berna T.", "id": "6AEH1ho2sFA6SuzGoEDWMg"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/static/20090416/i/new/gfx/blank_user_extra_small.gif", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/7-dAb6BdjgJE_KHTX9CNGA?srid=8_kbZ8PfEEzREMiYqv6iyQ", "url": "http://www.yelp.com/biz/sweeties-san-francisco#hrid:8_kbZ8PfEEzREMiYqv6iyQ", "user_url": "http://www.yelp.com/user_details?userid=3xsmXxDysn5yqflq3AzWKQ", "text_excerpt": "We don't live in the North Beach, but we still felt like neighbors when we visited Sweeties on Valentine's Day 2009. My fiancee and I dropped by after...", "user_photo_url": "http://static.px.yelp.com/static/20090416/i/new/gfx/blank_user_small.gif", "date": "2009-02-28", "user_name": "Tim N.", "id": "8_kbZ8PfEEzREMiYqv6iyQ"}], "nearby_url": "http://www.yelp.com/search?find_loc=475+Francisco+Street%2C+San+Francisco%2C+CA+94133"}, {"rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4_half.png", "country_code": "US", "id": "_cJARVZ55acNpNeCRmHTmQ", "is_closed": false, "city": "San Francisco", "mobile_url": "http://mobile.yelp.com/biz/_cJARVZ55acNpNeCRmHTmQ", "review_count": 88, "zip": "94109", "state": "CA", "latitude": 37.785784999999997, "rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4_half.png", "address1": "1060 Geary St", "address2": "", "address3": "", "phone": "4158854788", "state_code": "CA", "categories": [{"category_filter": "bars", "search_url": "http://www.yelp.com/search?find_loc=1060+Geary+St%2C+San+Francisco%2C+CA+94109&cflt=bars", "name": "Bars"}], "photo_url": "http://static.px.yelp.com/bpthumb/U_PzfAHm5cyg7wOF2FjE-w/ms", "distance": 0.74834960699081421, "name": "KoKo Cocktails", "neighborhoods": [{"url": "http://www.yelp.com/search?find_loc=Civic+Center%2FTenderloin%2C+San+Francisco%2C+CA", "name": "Civic Center/Tenderloin"}, {"url": "http://www.yelp.com/search?find_loc=Nob+Hill%2C+San+Francisco%2C+CA", "name": "Nob Hill"}], "url": "http://www.yelp.com/biz/koko-cocktails-san-francisco", "country": "USA", "avg_rating": 4.5, "longitude": -122.420721, "photo_url_small": "http://static.px.yelp.com/bpthumb/U_PzfAHm5cyg7wOF2FjE-w/ss", "reviews": [{"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/8JO3AwYQADb4oEgywyiHkw/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/_cJARVZ55acNpNeCRmHTmQ?srid=tWELGmx8xmZv9fUENn7jIA", "url": "http://www.yelp.com/biz/koko-cocktails-san-francisco#hrid:tWELGmx8xmZv9fUENn7jIA", "user_url": "http://www.yelp.com/user_details?userid=iV_Hnp3sFxncd6MNhkndGA", "text_excerpt": "Epic drinks and legendary bartenders. I wish I was at Koko's right now.\n\np.s. Autumn K. at Koko's? I'll believe it when I see it. :D", "user_photo_url": "http://static.px.yelp.com/upthumb/8JO3AwYQADb4oEgywyiHkw/ms", "date": "2009-04-02", "user_name": "Chris R.", "id": "tWELGmx8xmZv9fUENn7jIA"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/gqiMnFeJ-Ddlw_4b0w1-VA/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/_cJARVZ55acNpNeCRmHTmQ?srid=zlYWR5eGTcK3UbCD_URGHQ", "url": "http://www.yelp.com/biz/koko-cocktails-san-francisco#hrid:zlYWR5eGTcK3UbCD_URGHQ", "user_url": "http://www.yelp.com/user_details?userid=0sPPamYvk77rDOYECr_85A", "text_excerpt": "New and much cooler cocktail menu!! Who wants some?", "user_photo_url": "http://static.px.yelp.com/upthumb/gqiMnFeJ-Ddlw_4b0w1-VA/ms", "date": "2009-04-02", "user_name": "Chard M.", "id": "zlYWR5eGTcK3UbCD_URGHQ"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/O4cr5BaYOCApJIHhnqDEtw/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/_cJARVZ55acNpNeCRmHTmQ?srid=u3pvhJyoOZ0Q602Xjc-7kA", "url": "http://www.yelp.com/biz/koko-cocktails-san-francisco#hrid:u3pvhJyoOZ0Q602Xjc-7kA", "user_url": "http://www.yelp.com/user_details?userid=K6jTnDUtLuxyTFASgCS-gw", "text_excerpt": "Yes, people do still say rad (at least I do) and this bar is definitely rad! As are the bartenders, if you hook them up, they will hook you up. But don't...", "user_photo_url": "http://static.px.yelp.com/upthumb/O4cr5BaYOCApJIHhnqDEtw/ms", "date": "2009-03-29", "user_name": "Ronaldo T.", "id": "u3pvhJyoOZ0Q602Xjc-7kA"}], "nearby_url": "http://www.yelp.com/search?find_loc=1060+Geary+St%2C+San+Francisco%2C+CA+94109"}, {"rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4_half.png", "country_code": "US", "id": "WS9QI7amntnRUu-cgewQAw", "is_closed": false, "city": "San Francisco", "mobile_url": "http://mobile.yelp.com/biz/WS9QI7amntnRUu-cgewQAw", "review_count": 33, "zip": "94118", "state": "CA", "latitude": 37.777500152587898, "rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4_half.png", "address1": "598 5th Avenue", "address2": "", "address3": "", "phone": "4157511449", "state_code": "CA", "categories": [{"category_filter": "bars", "search_url": "http://www.yelp.com/search?find_loc=598+5th+Avenue%2C+San+Francisco%2C+CA+94118&cflt=bars", "name": "Bars"}], "photo_url": "http://static.px.yelp.com/bpthumb/e6tjIs4o7g4prs25U2nkxg/ms", "distance": 2.3935027122497559, "name": "O'Keeffe's Bar", "neighborhoods": [{"url": "http://www.yelp.com/search?find_loc=Inner+Richmond%2C+San+Francisco%2C+CA", "name": "Inner Richmond"}], "url": "http://www.yelp.com/biz/okeeffes-bar-san-francisco", "country": "USA", "avg_rating": 4.5, "longitude": -122.462997436523, "photo_url_small": "http://static.px.yelp.com/bpthumb/e6tjIs4o7g4prs25U2nkxg/ss", "reviews": [{"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/static/20090416/i/new/gfx/blank_user_extra_small.gif", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/WS9QI7amntnRUu-cgewQAw?srid=NJfFkIR1k1SFkACtePHnWA", "url": "http://www.yelp.com/biz/okeeffes-bar-san-francisco#hrid:NJfFkIR1k1SFkACtePHnWA", "user_url": "http://www.yelp.com/user_details?userid=qxEwdvhxDw51cAEejXK83g", "text_excerpt": "Met Annie at her spot behind the bar. She is one tough lady, old school irish. My bud Jim grew up around there, heard him tell many cool stories from the...", "user_photo_url": "http://static.px.yelp.com/static/20090416/i/new/gfx/blank_user_small.gif", "date": "2009-04-17", "user_name": "Dan M.", "id": "NJfFkIR1k1SFkACtePHnWA"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/OhMim2CBXFYiz7uOpGu2jQ/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4.png", "rating": 4, "mobile_uri": "http://mobile.yelp.com/biz/WS9QI7amntnRUu-cgewQAw?srid=6tuZws8FKafDWTwV8gPiAg", "url": "http://www.yelp.com/biz/okeeffes-bar-san-francisco#hrid:6tuZws8FKafDWTwV8gPiAg", "user_url": "http://www.yelp.com/user_details?userid=DcmI6NlZykgvvZ4SkYoTdA", "text_excerpt": "This place is the epitome of \"Dive.\" Came here on St. Patty's day, and it surely lived up to being Irish. The small band with children playing drums and...", "user_photo_url": "http://static.px.yelp.com/upthumb/OhMim2CBXFYiz7uOpGu2jQ/ms", "date": "2009-03-18", "user_name": "Ruchi P.", "id": "6tuZws8FKafDWTwV8gPiAg"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/-wkOaTBgkX78kgWd9qKLDg/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4.png", "rating": 4, "mobile_uri": "http://mobile.yelp.com/biz/WS9QI7amntnRUu-cgewQAw?srid=GgR8AfSlTQWN0kF-lKk-zw", "url": "http://www.yelp.com/biz/okeeffes-bar-san-francisco#hrid:GgR8AfSlTQWN0kF-lKk-zw", "user_url": "http://www.yelp.com/user_details?userid=emF8KqAfI2VL6Sfaek9gFg", "text_excerpt": "You know it's time to go home on St. Patrick's Day when you're at a smoky 95% authentic Irish bar, the live drum and recorder band of Irish children has...", "user_photo_url": "http://static.px.yelp.com/upthumb/-wkOaTBgkX78kgWd9qKLDg/ms", "date": "2009-03-17", "user_name": "Kate V.", "id": "GgR8AfSlTQWN0kF-lKk-zw"}], "nearby_url": "http://www.yelp.com/search?find_loc=598+5th+Avenue%2C+San+Francisco%2C+CA+94118"}, {"rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4.png", "country_code": "US", "id": "BOQOJXezjYZWolsmTcF2UA", "is_closed": false, "city": "San Francisco", "mobile_url": "http://mobile.yelp.com/biz/BOQOJXezjYZWolsmTcF2UA", "review_count": 36, "zip": "94103", "state": "CA", "latitude": 37.768317000000003, "rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4.png", "address1": "1799 Mission St", "address2": "at 14th St", "address3": "", "phone": "4158613002", "state_code": "CA", "categories": [{"category_filter": "bars", "search_url": "http://www.yelp.com/search?find_loc=1799+Mission+St%2C+San+Francisco%2C+CA+94103&cflt=bars", "name": "Bars"}], "photo_url": "http://static.px.yelp.com/bpthumb/gBxuzXOtKuRR9t29myOPYg/ms", "distance": 0.46441715955734253, "name": "Ace Cafe", "neighborhoods": [{"url": "http://www.yelp.com/search?find_loc=Mission%2C+San+Francisco%2C+CA", "name": "Mission"}], "url": "http://www.yelp.com/biz/ace-cafe-san-francisco", "country": "USA", "avg_rating": 4.0, "longitude": -122.420008, "photo_url_small": "http://static.px.yelp.com/bpthumb/gBxuzXOtKuRR9t29myOPYg/ss", "reviews": [{"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/-LlBQzy_lMDN8rqcZxxduQ/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4.png", "rating": 4, "mobile_uri": "http://mobile.yelp.com/biz/BOQOJXezjYZWolsmTcF2UA?srid=7Dh2kxj3f8r_kgRdZPUvvQ", "url": "http://www.yelp.com/biz/ace-cafe-san-francisco#hrid:7Dh2kxj3f8r_kgRdZPUvvQ", "user_url": "http://www.yelp.com/user_details?userid=CqMlDAQW_5Rj7Nu2hIrwfw", "text_excerpt": "I thoroughly enjoyed The Ace Caf\u00e9 at 14th and Mission Street and highly recommend it to anyone who doesn't mind a little smoke, can appreciate a diverse...", "user_photo_url": "http://static.px.yelp.com/upthumb/-LlBQzy_lMDN8rqcZxxduQ/ms", "date": "2009-02-24", "user_name": "Gadiel M.", "id": "7Dh2kxj3f8r_kgRdZPUvvQ"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4.png", "user_photo_url_small": "http://static.px.yelp.com/static/20090416/i/new/gfx/blank_user_extra_small.gif", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4.png", "rating": 4, "mobile_uri": "http://mobile.yelp.com/biz/BOQOJXezjYZWolsmTcF2UA?srid=Vo3lgIL74UZSi5J7iPw1oQ", "url": "http://www.yelp.com/biz/ace-cafe-san-francisco#hrid:Vo3lgIL74UZSi5J7iPw1oQ", "user_url": "http://www.yelp.com/user_details?userid=17AUx3RVchxyaqk71ygWaw", "text_excerpt": "Best fish and chips around. ( don't worry about the bikers, they're weak )", "user_photo_url": "http://static.px.yelp.com/static/20090416/i/new/gfx/blank_user_small.gif", "date": "2009-01-09", "user_name": "jeff b.", "id": "Vo3lgIL74UZSi5J7iPw1oQ"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_3.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/PoGEmHpxRjKFiNOFz1a2jw/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_3.png", "rating": 3, "mobile_uri": "http://mobile.yelp.com/biz/BOQOJXezjYZWolsmTcF2UA?srid=6GvHJ_XmbQNd74VihlIDdA", "url": "http://www.yelp.com/biz/ace-cafe-san-francisco#hrid:6GvHJ_XmbQNd74VihlIDdA", "user_url": "http://www.yelp.com/user_details?userid=XnbGrJNw0wglmqXekW138Q", "text_excerpt": "funny little dive bar... they do have snacks, plenty of tables, a pool table, and a good jukebox. minus one star because you can smoke there (which for...", "user_photo_url": "http://static.px.yelp.com/upthumb/PoGEmHpxRjKFiNOFz1a2jw/ms", "date": "2008-12-08", "user_name": "Carolyn B.", "id": "6GvHJ_XmbQNd74VihlIDdA"}], "nearby_url": "http://www.yelp.com/search?find_loc=1799+Mission+St%2C+San+Francisco%2C+CA+94103"}, {"rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4.png", "country_code": "US", "id": "owj5tzY8w8zXSXza_LS8NQ", "is_closed": false, "city": "San Francisco", "mobile_url": "http://mobile.yelp.com/biz/owj5tzY8w8zXSXza_LS8NQ", "review_count": 371, "zip": "94102", "state": "CA", "latitude": 37.773701000000003, "rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4.png", "address1": "45 Rose St", "address2": "", "address3": "", "phone": "4157030403", "state_code": "CA", "categories": [{"category_filter": "wine_bars", "search_url": "http://www.yelp.com/search?find_loc=45+Rose+St%2C+San+Francisco%2C+CA+94102&cflt=wine_bars", "name": "Wine Bars"}], "photo_url": "http://static.px.yelp.com/bpthumb/xOFIYiRKU8NjyBsyGw5Rxg/ms", "distance": 0.16015078127384186, "name": "H\u00f4tel Biron", "neighborhoods": [{"url": "http://www.yelp.com/search?find_loc=Hayes+Valley%2C+San+Francisco%2C+CA", "name": "Hayes Valley"}], "url": "http://www.yelp.com/biz/hotel-biron-san-francisco", "country": "USA", "avg_rating": 4.0, "longitude": -122.42170400000001, "photo_url_small": "http://static.px.yelp.com/bpthumb/xOFIYiRKU8NjyBsyGw5Rxg/ss", "reviews": [{"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/NR3YhAUjzQ4SZgkg6vqheA/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/owj5tzY8w8zXSXza_LS8NQ?srid=vabDEJCITNijgdNAU0nugQ", "url": "http://www.yelp.com/biz/hotel-biron-san-francisco#hrid:vabDEJCITNijgdNAU0nugQ", "user_url": "http://www.yelp.com/user_details?userid=Fnw_f0X0-cBscRr4sX5JYg", "text_excerpt": "I checked this place out on Monday, and it lived up to all the hype. The wine selection was impressive, and the staff friendly. Its tiny, but yet it gives...", "user_photo_url": "http://static.px.yelp.com/upthumb/NR3YhAUjzQ4SZgkg6vqheA/ms", "date": "2009-04-15", "user_name": "Emmy B.", "id": "vabDEJCITNijgdNAU0nugQ"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/-9iUpFLA7gUwU-xeVczgLA/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4.png", "rating": 4, "mobile_uri": "http://mobile.yelp.com/biz/owj5tzY8w8zXSXza_LS8NQ?srid=rZvHiZioZHzbK9SGEsAfhA", "url": "http://www.yelp.com/biz/hotel-biron-san-francisco#hrid:rZvHiZioZHzbK9SGEsAfhA", "user_url": "http://www.yelp.com/user_details?userid=AzUISA7zjPXVzxOBuNVUBA", "text_excerpt": "Amazingly I was taken here on a \"date\". I say amazingly in reference to this economy and the fact that some one was willing to spend such ridiculous monies...", "user_photo_url": "http://static.px.yelp.com/upthumb/-9iUpFLA7gUwU-xeVczgLA/ms", "date": "2009-04-06", "user_name": "montgomery r.", "id": "rZvHiZioZHzbK9SGEsAfhA"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/AL3w82TCtSeJHHWon43RUw/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/owj5tzY8w8zXSXza_LS8NQ?srid=6kA_HdUvQuOPZGiYaRoMOw", "url": "http://www.yelp.com/biz/hotel-biron-san-francisco#hrid:6kA_HdUvQuOPZGiYaRoMOw", "user_url": "http://www.yelp.com/user_details?userid=zpXqbJQ2CT4PsUBTy30DbQ", "text_excerpt": "Adorable, amazing. The cutest little European hotel / wine bar I've ever seen in San Francisco\n\nCame here for a drink before dinner in Hayes Valley. It's...", "user_photo_url": "http://static.px.yelp.com/upthumb/AL3w82TCtSeJHHWon43RUw/ms", "date": "2009-04-04", "user_name": "Jenny W.", "id": "6kA_HdUvQuOPZGiYaRoMOw"}], "nearby_url": "http://www.yelp.com/search?find_loc=45+Rose+St%2C+San+Francisco%2C+CA+94102"}, {"rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4_half.png", "country_code": "US", "id": "bcXY_zGB4zWQuNnxfR7Z3w", "is_closed": false, "city": "San Francisco", "mobile_url": "http://mobile.yelp.com/biz/bcXY_zGB4zWQuNnxfR7Z3w", "review_count": 141, "zip": "94133", "state": "CA", "latitude": 37.797460899999997, "rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4_half.png", "address1": "242 Columbus Avenue", "address2": "", "address3": "", "phone": "4159869651", "state_code": "CA", "categories": [{"category_filter": "bars", "search_url": "http://www.yelp.com/search?find_loc=242+Columbus+Avenue%2C+San+Francisco%2C+CA+94133&cflt=bars", "name": "Bars"}], "photo_url": "http://static.px.yelp.com/bpthumb/eetod47ppa8zUbX8L80o_A/ms", "distance": 1.7111668586730957, "name": "Tosca Cafe", "neighborhoods": [{"url": "http://www.yelp.com/search?find_loc=North+Beach%2FTelegraph+Hill%2C+San+Francisco%2C+CA", "name": "North Beach/Telegraph Hill"}, {"url": "http://www.yelp.com/search?find_loc=Nob+Hill%2C+San+Francisco%2C+CA", "name": "Nob Hill"}], "url": "http://www.yelp.com/biz/tosca-cafe-san-francisco", "country": "USA", "avg_rating": 4.5, "longitude": -122.40604879999999, "photo_url_small": "http://static.px.yelp.com/bpthumb/eetod47ppa8zUbX8L80o_A/ss", "reviews": [{"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_4.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/QS-jEagZ4se63l9kV87XWA/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_4.png", "rating": 4, "mobile_uri": "http://mobile.yelp.com/biz/bcXY_zGB4zWQuNnxfR7Z3w?srid=YaZ8zIeIhOGE0Q90hyaHxQ", "url": "http://www.yelp.com/biz/tosca-cafe-san-francisco#hrid:YaZ8zIeIhOGE0Q90hyaHxQ", "user_url": "http://www.yelp.com/user_details?userid=KpwPavO0PtuSTIaJ2Uslfg", "text_excerpt": "The vibe here is spooky!! I like being spooked out, I think it's fun, like watching a scary movie or something, so I really liked it. The seating is 50s...", "user_photo_url": "http://static.px.yelp.com/upthumb/QS-jEagZ4se63l9kV87XWA/ms", "date": "2009-04-11", "user_name": "Elizabeth B.", "id": "YaZ8zIeIhOGE0Q90hyaHxQ"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_5.png", "user_photo_url_small": "http://static.px.yelp.com/static/20090416/i/new/gfx/blank_user_extra_small.gif", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_5.png", "rating": 5, "mobile_uri": "http://mobile.yelp.com/biz/bcXY_zGB4zWQuNnxfR7Z3w?srid=bDXqtUlB4_xbAXhPG_eslw", "url": "http://www.yelp.com/biz/tosca-cafe-san-francisco#hrid:bDXqtUlB4_xbAXhPG_eslw", "user_url": "http://www.yelp.com/user_details?userid=755f5UrhlcEiPjfLUcKdDw", "text_excerpt": "The world famous Tosca Cafe is a home away from home, a private club, a public meeting place, shelter from the storm, what you need when you need it,\nThe...", "user_photo_url": "http://static.px.yelp.com/static/20090416/i/new/gfx/blank_user_small.gif", "date": "2009-04-10", "user_name": "Dale D.", "id": "bDXqtUlB4_xbAXhPG_eslw"}, {"rating_img_url_small": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_small_2.png", "user_photo_url_small": "http://static.px.yelp.com/upthumb/XyhcfxLEyoEJl1jLB1gkLA/ss", "rating_img_url": "http://static.px.yelp.com/static/20090416/i/new/ico/stars/stars_2.png", "rating": 2, "mobile_uri": "http://mobile.yelp.com/biz/bcXY_zGB4zWQuNnxfR7Z3w?srid=JqOunqnq9xLTYW1LfVjsfA", "url": "http://www.yelp.com/biz/tosca-cafe-san-francisco#hrid:JqOunqnq9xLTYW1LfVjsfA", "user_url": "http://www.yelp.com/user_details?userid=IWal1ziP1AlfcgDJj5CKFw", "text_excerpt": "2.stars for the ambiance, the rest, eh.\nCool spot but it was pretty empty on a friday evening from when we got there at 9 o'clock until we left a couple of...", "user_photo_url": "http://static.px.yelp.com/upthumb/XyhcfxLEyoEJl1jLB1gkLA/ms", "date": "2009-04-04", "user_name": "Aaron T.", "id": "JqOunqnq9xLTYW1LfVjsfA"}], "nearby_url": "http://www.yelp.com/search?find_loc=242+Columbus+Avenue%2C+San+Francisco%2C+CA+94133"}]}
data/ext/extconf.rb CHANGED
@@ -1,3 +1,4 @@
1
+ # encoding: UTF-8
1
2
  require 'mkmf'
2
3
  dir_config('yajl')
3
4
  have_header('yajl/yajl_parse.h')
data/ext/yajl.c CHANGED
@@ -1,8 +1,15 @@
1
- #include <yajl/yajl_parse.h>
2
- #include <yajl/yajl_gen.h>
3
- #include <ruby.h>
1
+ #include "yajl.h"
4
2
 
5
- static VALUE cParseError;
3
+ void check_and_fire_callback(void * ctx) {
4
+ yajl_status stat;
5
+
6
+ if (RARRAY_LEN((VALUE)ctx) == 1 && parse_complete_callback != Qnil) {
7
+ // parse any remaining buffered data
8
+ stat = yajl_parse_complete(chunkedParser);
9
+
10
+ rb_funcall(parse_complete_callback, intern_call, 1, rb_ary_pop((VALUE)ctx));
11
+ }
12
+ }
6
13
 
7
14
  void set_static_value(void * ctx, VALUE val) {
8
15
  VALUE len = RARRAY_LEN((VALUE)ctx);
@@ -39,11 +46,13 @@ void set_static_value(void * ctx, VALUE val) {
39
46
 
40
47
  static int found_null(void * ctx) {
41
48
  set_static_value(ctx, Qnil);
49
+ check_and_fire_callback(ctx);
42
50
  return 1;
43
51
  }
44
52
 
45
53
  static int found_boolean(void * ctx, int boolean) {
46
54
  set_static_value(ctx, boolean ? Qtrue : Qfalse);
55
+ check_and_fire_callback(ctx);
47
56
  return 1;
48
57
  }
49
58
 
@@ -55,12 +64,13 @@ static int found_number(void * ctx, const char * numberVal, unsigned int numberL
55
64
  } else {
56
65
  set_static_value(ctx, rb_Integer(rb_str_new(numberVal, numberLen)));
57
66
  }
58
-
67
+ check_and_fire_callback(ctx);
59
68
  return 1;
60
69
  }
61
70
 
62
71
  static int found_string(void * ctx, const unsigned char * stringVal, unsigned int stringLen) {
63
72
  set_static_value(ctx, rb_str_new((char *)stringVal, stringLen));
73
+ check_and_fire_callback(ctx);
64
74
  return 1;
65
75
  }
66
76
 
@@ -78,6 +88,7 @@ static int found_end_hash(void * ctx) {
78
88
  if (RARRAY_LEN((VALUE)ctx) > 1) {
79
89
  rb_ary_pop((VALUE)ctx);
80
90
  }
91
+ check_and_fire_callback(ctx);
81
92
  return 1;
82
93
  }
83
94
 
@@ -90,66 +101,101 @@ static int found_end_array(void * ctx) {
90
101
  if (RARRAY_LEN((VALUE)ctx) > 1) {
91
102
  rb_ary_pop((VALUE)ctx);
92
103
  }
104
+ check_and_fire_callback(ctx);
93
105
  return 1;
94
106
  }
95
107
 
96
- static yajl_callbacks callbacks = {
97
- found_null,
98
- found_boolean,
99
- NULL,
100
- NULL,
101
- found_number,
102
- found_string,
103
- found_start_hash,
104
- found_hash_key,
105
- found_end_hash,
106
- found_start_array,
107
- found_end_array
108
- };
109
-
110
- static ID intern_io_read, intern_eof;
111
- static yajl_parser_config cfg = {1, 1};
108
+ static VALUE t_setParseComplete(VALUE self, VALUE callback) {
109
+ parse_complete_callback = callback;
110
+ return Qnil;
111
+ }
112
+
113
+ static VALUE t_parseSome(VALUE self, VALUE string) {
114
+ yajl_status stat;
115
+
116
+ if (string == Qnil) {
117
+ rb_raise(cParseError, "%s", "Can't parse a nil string.");
118
+ return Qnil;
119
+ }
120
+
121
+ if (parse_complete_callback != Qnil) {
122
+ if (context == Qnil) {
123
+ context = rb_ary_new();
124
+ }
125
+ if (chunkedParser == NULL) {
126
+ // allocate our parser
127
+ chunkedParser = yajl_alloc(&callbacks, &cfg, NULL, (void *)context);
128
+ }
129
+
130
+ stat = yajl_parse(chunkedParser, (const unsigned char *)RSTRING_PTR(string), RSTRING_LEN(string));
131
+ if (stat != yajl_status_ok && stat != yajl_status_insufficient_data) {
132
+ unsigned char * str = yajl_get_error(chunkedParser, 1, (const unsigned char *)RSTRING_PTR(string), RSTRING_LEN(string));
133
+ rb_raise(cParseError, "%s", (const char *) str);
134
+ yajl_free_error(chunkedParser, str);
135
+ }
136
+ } else {
137
+ rb_raise(cParseError, "%s", "The on_parse_complete callback isn't setup, parsing useless.");
138
+ }
139
+
140
+ if (RARRAY_LEN(context) == 0) {
141
+ yajl_free(chunkedParser);
142
+ }
143
+
144
+ return Qnil;
145
+ }
112
146
 
113
147
  static VALUE t_parse(VALUE self, VALUE io) {
114
- yajl_handle hand;
115
148
  yajl_status stat;
116
- int bufferSize = 8192;
117
- intern_io_read = rb_intern("read");
118
- intern_eof = rb_intern("eof?");
119
- VALUE ctx = rb_ary_new();
149
+ context = rb_ary_new();
120
150
 
121
151
  // allocate our parser
122
- hand = yajl_alloc(&callbacks, &cfg, NULL, (void *)ctx);
123
- VALUE parsed = rb_str_new("", 0);
124
- VALUE rbufsize = INT2FIX(bufferSize);
152
+ streamParser = yajl_alloc(&callbacks, &cfg, NULL, (void *)context);
153
+
154
+ VALUE parsed = rb_str_new("", readBufferSize);
155
+ VALUE rbufsize = INT2FIX(readBufferSize);
125
156
 
126
157
  // now parse from the IO
127
158
  while (rb_funcall(io, intern_eof, 0) == Qfalse) {
128
- rb_funcall(io, intern_io_read, 2, rbufsize, parsed);
159
+ parsed = rb_funcall(io, intern_io_read, 1, rbufsize);
129
160
 
130
- stat = yajl_parse(hand, (const unsigned char *)RSTRING_PTR(parsed), RSTRING_LEN(parsed));
161
+ stat = yajl_parse(streamParser, (const unsigned char *)RSTRING_PTR(parsed), RSTRING_LEN(parsed));
131
162
 
132
163
  if (stat != yajl_status_ok && stat != yajl_status_insufficient_data) {
133
- unsigned char * str = yajl_get_error(hand, 1, (const unsigned char *)RSTRING_PTR(parsed), RSTRING_LEN(parsed));
164
+ unsigned char * str = yajl_get_error(streamParser, 1, (const unsigned char *)RSTRING_PTR(parsed), RSTRING_LEN(parsed));
134
165
  rb_raise(cParseError, "%s", (const char *) str);
135
- yajl_free_error(hand, str);
166
+ yajl_free_error(streamParser, str);
136
167
  break;
137
168
  }
138
169
  }
139
170
 
140
171
  // parse any remaining buffered data
141
- stat = yajl_parse_complete(hand);
142
- yajl_free(hand);
172
+ stat = yajl_parse_complete(streamParser);
173
+ yajl_free(streamParser);
174
+
175
+ if (parse_complete_callback != Qnil) {
176
+ check_and_fire_callback((void *)context);
177
+ return Qnil;
178
+ }
143
179
 
144
- return rb_ary_pop(ctx);
180
+ return rb_ary_pop(context);
145
181
  }
146
182
 
147
- static VALUE mYajl, mNative;
148
-
149
183
  void Init_yajl() {
150
184
  mYajl = rb_define_module("Yajl");
151
- mNative = rb_define_module_under(mYajl, "Native");
152
- rb_define_module_function(mNative, "parse", t_parse, 1);
185
+
186
+ mStream = rb_define_module_under(mYajl, "Stream");
187
+ rb_define_module_function(mStream, "parse", t_parse, 1);
188
+
189
+ mChunked = rb_define_module_under(mYajl, "Chunked");
190
+ rb_define_module_function(mChunked, "parse_some", t_parseSome, 1);
191
+ rb_define_module_function(mChunked, "<<", t_parseSome, 1);
192
+ rb_define_module_function(mChunked, "on_parse_complete=", t_setParseComplete, 1);
193
+
153
194
  VALUE rb_cStandardError = rb_const_get(rb_cObject, rb_intern("StandardError"));
154
195
  cParseError = rb_define_class_under(mYajl, "ParseError", rb_cStandardError);
196
+
197
+ intern_io_read = rb_intern("read");
198
+ intern_eof = rb_intern("eof?");
199
+ intern_respond_to = rb_intern("respond_to?");
200
+ intern_call = rb_intern("call");
155
201
  }
data/ext/yajl.h ADDED
@@ -0,0 +1,45 @@
1
+ #include <yajl/yajl_parse.h>
2
+ #include <yajl/yajl_gen.h>
3
+ #include <ruby.h>
4
+
5
+ #define READ_BUFSIZE 4096
6
+
7
+ static VALUE cParseError, mYajl, mStream, mChunked;
8
+ static ID intern_io_read, intern_eof, intern_respond_to, intern_call;
9
+ static int readBufferSize = READ_BUFSIZE;
10
+ static yajl_parser_config cfg = {1, 1};
11
+
12
+ yajl_handle streamParser = NULL, chunkedParser = NULL;
13
+ VALUE context = Qnil;
14
+ VALUE parse_complete_callback = Qnil;
15
+
16
+ void check_and_fire_callback(void * ctx);
17
+ void set_static_value(void * ctx, VALUE val);
18
+
19
+ static int found_null(void * ctx);
20
+ static int found_boolean(void * ctx, int boolean);
21
+ static int found_number(void * ctx, const char * numberVal, unsigned int numberLen);
22
+ static int found_string(void * ctx, const unsigned char * stringVal, unsigned int stringLen);
23
+ static int found_hash_key(void * ctx, const unsigned char * stringVal, unsigned int stringLen);
24
+ static int found_start_hash(void * ctx);
25
+ static int found_end_hash(void * ctx);
26
+ static int found_start_array(void * ctx);
27
+ static int found_end_array(void * ctx);
28
+
29
+ static yajl_callbacks callbacks = {
30
+ found_null,
31
+ found_boolean,
32
+ NULL,
33
+ NULL,
34
+ found_number,
35
+ found_string,
36
+ found_start_hash,
37
+ found_hash_key,
38
+ found_end_hash,
39
+ found_start_array,
40
+ found_end_array
41
+ };
42
+
43
+ static VALUE t_setParseComplete(VALUE self, VALUE callback);
44
+ static VALUE t_parseSome(VALUE self, VALUE string);
45
+ static VALUE t_parse(VALUE self, VALUE io);
@@ -0,0 +1,67 @@
1
+ # encoding: UTF-8
2
+ require 'socket' unless defined?(Socket)
3
+ require 'zlib' unless defined?(Zlib)
4
+ require 'yajl' unless defined?(Yajl)
5
+
6
+ module Yajl
7
+ # == Yajl::HttpStream
8
+ #
9
+ # This module is for making HTTP requests to which the response bodies (and possibly requests in the near future)
10
+ # are streamed directly into Yajl.
11
+ class HttpStream
12
+ # === Yajl::HttpStream::InvalidContentType
13
+ #
14
+ # This Exception is thrown when an HTTP response isn't application/json
15
+ # and therefore cannot be parsed.
16
+ class InvalidContentType < Exception; end
17
+
18
+ # The mime-type we expect the response to be. If it's anything else, we can't parse it
19
+ # and an InvalidContentType is raised.
20
+ MIME_TYPE = "application/json"
21
+
22
+ # Makes a basic HTTP GET request to the URI provided
23
+ # 1. a raw socket is opened to the server/host provided
24
+ # 2. the request is made using HTTP/1.0, Accept-encoding: gzip (deflate support coming soon, too)
25
+ # 3. the response is read until the end of the headers
26
+ # 4. the _socket itself_ is passed directly to Yajl, for direct parsing off the stream;
27
+ # As it's being received over the wire!
28
+ def self.get(uri)
29
+ socket = Socket.new(Socket::Constants::AF_INET, Socket::Constants::SOCK_STREAM, 0)
30
+ sockaddr = Socket.pack_sockaddr_in(uri.port, uri.host)
31
+ socket.connect(sockaddr)
32
+ socket.write("GET #{uri.path}?#{uri.query} HTTP/1.0\r\nAccept-encoding: gzip\r\n\r\n")
33
+
34
+ response_head = {}
35
+ response_head[:headers] = {}
36
+
37
+ socket.each_line do |line|
38
+ if line == "\r\n" # end of the headers
39
+ break
40
+ else
41
+ header = line.split(": ")
42
+ if header.size == 1
43
+ header = header[0].split(" ")
44
+ response_head[:version] = header[0]
45
+ response_head[:code] = header[1].to_i
46
+ response_head[:msg] = header[2]
47
+ # this is the response code line
48
+ else
49
+ response_head[:headers][header[0]] = header[1].strip
50
+ end
51
+ end
52
+ end
53
+
54
+ if response_head[:headers]["Content-Type"].include?(MIME_TYPE)
55
+ case response_head[:headers]["Content-Encoding"]
56
+ when "gzip"
57
+ socket = Zlib::GzipReader.new(socket)
58
+ end
59
+ return Yajl::Stream.parse(socket)
60
+ else
61
+ raise InvalidContentType, "The response MIME type #{response_head[:headers]["Content-Type"]}"
62
+ end
63
+ ensure
64
+ socket.close
65
+ end
66
+ end
67
+ end
data/lib/yajl.rb ADDED
@@ -0,0 +1,32 @@
1
+ # encoding: UTF-8
2
+ require 'yajl'
3
+
4
+ # = Yajl
5
+ #
6
+ # Ruby bindings to the excellent Yajl (Yet Another JSON Parser) ANSI C library.
7
+ module Yajl
8
+ VERSION = "0.3.4"
9
+
10
+ # == Yajl::Chunked
11
+ #
12
+ # This module contains methods for parsing JSON in chunks.
13
+ # The use case here is that the caller may not be able to get access to the IO to which
14
+ # JSON content is being received. Rendering Yajl::Stream dead to them.
15
+ #
16
+ # With the methods in this module, the caller will be able to pass in chunks of JSON content
17
+ # until a full object has been parsed from said content.
18
+ #
19
+ # In order for this process to work correctly, the caller needs to specify a callback which
20
+ # is passed the constructed object. The only requirement currently of this callback is that
21
+ # it respond to #call and accept a single parameter (the object that was created from parsing).
22
+ module Chunked; end
23
+
24
+ # == Yajl::Stream
25
+ #
26
+ # This module contains methods for parsing JSON directly from an IO object.
27
+ #
28
+ # The only basic requirment currently is that the IO object respond to #read(len) and eof?
29
+ #
30
+ # The IO is parsed until a complete JSON object has been read and a ruby object will be returned.
31
+ module Stream; end
32
+ end