2013-03-20 67 views
1

我想解析Facebook饋送。解析Facebook饋送Json數據

這裏是我的JSON網址:http://www.facebook.com/feeds/page.php?id=199009743552420&format=json

所以我得到了響應這種類型的數據:

"content": "\u003Ca href=\"\/l.php?u=http\u00253A\u00252F\u00252Fwww.youtube.com\u00252Fwatch\u00253Fv\u00253D9_PaHtaKAug\u002526list\u00253DPLc4q0uG_h6x5tA_L3kHK6TE9TV6skf14n\u002526index\u00253D1\u002526feature\u00253Dplpp_video&h=0AQEQfrMH&s=1\" id=\"\" title=\"\" target=\"\" onclick=\"LinkshimAsyncLink.swap(this, "\\\/l.php?u=http\\u00253A\\u00252F\\u00252Fwww.youtube.com\\u00252Fwatch\\u00253Fv\\u00253D9_PaHtaKAug\\u002526list\\u00253DPLc4q0uG_h6x5tA_L3kHK6TE9TV6skf14n\\u002526index\\u00253D1\\u002526feature\\u00253Dplpp_video&h=0AQEQfrMH&s=1");\" style=\"\" rel=\"nofollow\" onmouseover=\"LinkshimAsyncLink.swap(this, "http:\\\/\\\/www.youtube.com\\\/watch?v=9_PaHtaKAug&list=PLc4q0uG_h6x5tA_L3kHK6TE9TV6skf14n&index=1&feature=plpp_video");\">\u003Cimg class=\"img\" src=\"http:\/\/external.ak.fbcdn.net\/safe_image.php?d=AQDshpKwwDhCYH9k&w=130&h=130&url=http\u00253A\u00252F\u00252Fi2.ytimg.com\u00252Fvi\u00252F9_PaHtaKAug\u00252Fmqdefault.jpg\" alt=\"\" style=\"height:90px;\" \/>\u003C\/a>\u003Cbr\/>\u003Ca href=\"\/l.php?u=http\u00253A\u00252F\u00252Fwww.youtube.com\u00252Fwatch\u00253Fv\u00253D9_PaHtaKAug\u002526list\u00253DPLc4q0uG_h6x5tA_L3kHK6TE9TV6skf14n\u002526index\u00253D1\u002526feature\u00253Dplpp_video&h=PAQEzb06t&s=1\" id=\"\" target=\"_blank\" onclick=\"LinkshimAsyncLink.swap(this, "\\\/l.php?u=http\\u00253A\\u00252F\\u00252Fwww.youtube.com\\u00252Fwatch\\u00253Fv\\u00253D9_PaHtaKAug\\u002526list\\u00253DPLc4q0uG_h6x5tA_L3kHK6TE9TV6skf14n\\u002526index\\u00253D1\\u002526feature\\u00253Dplpp_video&h=PAQEzb06t&s=1");\" style=\"\" rel=\"nofollow\" onmouseover=\"LinkshimAsyncLink.swap(this, "http:\\\/\\\/www.youtube.com\\\/watch?v=9_PaHtaKAug&list=PLc4q0uG_h6x5tA_L3kHK6TE9TV6skf14n&index=1&feature=plpp_video");\">The Dissident Files - Ausama Monajed at THiNK 2012\u003C\/a>\u003Cbr\/>www.youtube.com\u003Cbr\/>Ausama Monajed in conversation with NDTV's Vishnu Som in Tehelka's THiNK 2012 session on "The Troubled Looking Glass: Why You Should Care About Syria" For mo... " 

它包含了形象標識網址,視頻網址,....所以我怎麼能解析這種類型的數據?

請幫幫我。

感謝你

+0

http://stackoverflow.com/questions/9661845/json-parser -example-for-ios5 – Ultrakorne 2013-03-20 11:22:18

+0

@Ultrakorne我知道如何解析json數據,但我想解析@「內容」鍵的數據 – saurabh 2013-03-20 11:24:09

+0

一旦你獲得了內容json字段的字符串,它的html代碼。 – pdrcabrod 2013-03-20 11:31:22

回答

0

一旦你從JSON解析的內容領域,你將需要再次解析它在保持現在你正在處理的HTML代碼的頭腦。如果你想做一些複雜的查詢,你將不得不使用XPath和libxml2庫。

參見:iOS: Best way to parse html tags?

如果你只想做一個簡單的查詢,您可以通過字符串進行迭代,並選擇你想要什麼