2011-07-21 81 views
1

我试图用nokogiri来选择一个DOM元素,但它似乎是返回一个空数组。用Nokogiri解析源html的麻烦

我运行此代码:

require "open-uri" 
require "nokogiri" 

doc = Nokogiri::HTML(open("http://twitter.com/#!/ladygaga")) 

,并返回被引入nokogiri解析整个源代码。

然而,当我运行

doc.css(".stream-tweet") 

它返回一个空数组。 .stream-tweet是我通过检查源代码找到的http://twitter.com/#!/ladygaga多个div元素的类。

这是怎么回事吗?

回答

2

因为没有div元素,因此如果您看doc,请使用stream-tweet类。
该div随后通过AJAX请求加载到twitter api。

+0

是有办法让'doc'格式化更好?你究竟是什么意思“实际div加载之后通过JavaScript的Twitter API”。 –

+1

没有办法与nokogiri做到这一点,因为nokogiri无法解析ajax请求的结果。你为什么需要它?大概你可以使用twitter api。 – NARKOZ

+1

@Justin NARKOZ的含义是,如果你“查看源代码”(并且不检查元素),你会发现你声明的HTML在原始HTTP响应中并不存在。相反,JavaScript代码在网站上运行,并最终从11(!)个不同的XHR JSON请求中获得内容。 JavaScript然后用这些类动态地在页面上构建元素。 Nokogiri不是一个完整的Web浏览器,并且不运行JavaScript。 – Phrogz

1

@NARKOZ对你的问题有正确的答案,你为什么试图做的不工作。你应该接受这个答案。

解决您的问题,试试这个:

require 'open-uri' 
require 'json' 
require 'pp' 

gaga = JSON.parse(open('http://api.twitter.com/1/statuses/user_timeline.json?include_entities=1&include_available_features=1&contributor_details=true&include_rts=true&user_id=14230524').read) 

pp gaga.map{ |tweet| tweet['text'] }[0..3] 

#=> ["Here's my LIVE radio performance on the Howard Stern Show! http://bit.ly/pighVL\"", 
#=> "Thanks baby. I'm a die hard monsterfan [email protected]: @ladygaga 's album speaks to me more than any other album ever. #diehardfan", 
#=> "http://twitpic.com/5s4f2h - Just left @HowardStern, rockers with long hair have a sweetspot for girls like me. He was a doll. :)", 
#=> "SURPRISE MONSTERS! You can find a link to a more readable format of my V Mag Pop Culture Column on http://t.co/ekIJBXo My new blog!"] 

这里是整个JSON看起来像作为散列的红宝石阵列(截断堆栈溢出):

[{"in_reply_to_status_id"=>nil, 
    "user"=> 
    {"time_zone"=>"Quito", 
    "friends_count"=>142497, 
    "protected"=>false, 
    "location"=>"New York, NY", 
    "is_translator"=>false, 
    "following"=>true, 
    "profile_use_background_image"=>true, 
    "name"=>"Lady Gaga", 
    "follow_request_sent"=>false, 
    "statuses_count"=>968, 
    "profile_background_color"=>"9AE4E8", 
    "url"=>"http://www.ladygaga.com", 
    "default_profile"=>false, 
    "verified"=>true, 
    "profile_background_image_url"=> 
    "http://a1.twimg.com/profile_background_images/203383875/Unnamed-1.jpg", 
    "utc_offset"=>-18000, 
    "profile_background_image_url_https"=> 
    "https://si0.twimg.com/profile_background_images/203383875/Unnamed-1.jpg", 
    "favourites_count"=>2, 
    "created_at"=>"Wed Mar 26 22:37:48 +0000 2008", 
    "profile_text_color"=>"333333", 
    "profile_image_url_https"=> 
    "https://si0.twimg.com/profile_images/1239447061/Unnamed-1_normal.jpg", 
    "profile_image_url"=> 
    "http://a1.twimg.com/profile_images/1239447061/Unnamed-1_normal.jpg", 
    "listed_count"=>208144, 
    "profile_sidebar_fill_color"=>"DDFFCC", 
    "description"=>"mother mons\u2020er\r\n", 
    "contributors_enabled"=>false, 
    "lang"=>"en", 
    "profile_background_tile"=>true, 
    "followers_count"=>11781463, 
    "screen_name"=>"ladygaga", 
    "id_str"=>"14230524", 
    "profile_link_color"=>"0084B4", 
    "id"=>14230524, 
    "default_profile_image"=>false, 
    "show_all_inline_media"=>false, 
    "geo_enabled"=>false, 
    "notifications"=>true, 
    "profile_sidebar_border_color"=>"BDDCAD"}, 
    "created_at"=>"Tue Jul 19 18:09:40 +0000 2011", 
    "geo"=>nil, 
    "in_reply_to_user_id"=>nil, 
    "favorited"=>false, 
    "text"=> 
    "Here's my LIVE radio performance on the Howard Stern Show! http://bit.ly/pighVL\"", 
    "in_reply_to_status_id_str"=>nil, 
    "entities"=> 
    {"user_mentions"=>[], 
    "urls"=> 
    [{"url"=>"http://bit.ly/pighVL", 
     "indices"=>[59, 79], 
     "expanded_url"=>nil}], 
    "hashtags"=>[]}, 
    "in_reply_to_screen_name"=>nil, 
    "in_reply_to_user_id_str"=>nil, 
    "place"=>nil, 
    "coordinates"=>nil, 
    "truncated"=>false, 
    "source"=> 
    "<a href=\"http://blackberry.com/twitter\" rel=\"nofollow\">Twitter for BlackBerry\u00AE</a>", 
    "id_str"=>"93382007496769536", 
    "contributors"=>nil, 
    "retweeted"=>false, 
    "retweet_count"=>"100+", 
    "id"=>93382007496769536}, 
{"in_reply_to_status_id"=>nil, 
    "user"=> 
    {"time_zone"=>"Quito", 
    "protected"=>false, 
    "location"=>"New York, NY", 
    "contributors_enabled"=>false, 
    "following"=>true, 
    "profile_use_background_image"=>true, 
    "name"=>"Lady Gaga", 
    "default_profile_image"=>false, 
    "profile_background_color"=>"9AE4E8", 
    "url"=>"http://www.ladygaga.com", 
    "default_profile"=>false, 
    "verified"=>true, 
    "profile_background_image_url"=> 
    "http://a1.twimg.com/profile_background_images/203383875/Unnamed-1.jpg", 
    "utc_offset"=>-18000, 
    "friends_count"=>142497, 
    "is_translator"=>false, 
    "show_all_inline_media"=>false, 
    "geo_enabled"=>false, 
    "favourites_count"=>2, 
    "created_at"=>"Wed Mar 26 22:37:48 +0000 2008", 
    "follow_request_sent"=>false, 
    "profile_text_color"=>"333333", 
    "profile_image_url"=> 
    "http://a1.twimg.com/profile_images/1239447061/Unnamed-1_normal.jpg", 
    "profile_sidebar_fill_color"=>"DDFFCC", 
    "description"=>"mother mons\u2020er\r\n", 
    "lang"=>"en", 
    "statuses_count"=>968, 
    "profile_background_tile"=>true, 
    "followers_count"=>11781456, 
    "screen_name"=>"ladygaga", 
    "id_str"=>"14230524", 
    "listed_count"=>208145, 
    "profile_background_image_url_https"=> 
    "https://si0.twimg.com/profile_background_images/203383875/Unnamed-1.jpg", 
    "profile_link_color"=>"0084B4", 
    "id"=>14230524, 
    "notifications"=>false, 
    "profile_sidebar_border_color"=>"BDDCAD", 
    "profile_image_url_https"=> 
    "https://si0.twimg.com/profile_images/1239447061/Unnamed-1_normal.jpg"}, 
    "created_at"=>"Tue Jul 19 17:51:11 +0000 2011", 
    "geo"=>nil, 
    "in_reply_to_user_id"=>nil, 
    "favorited"=>false, 
    "text"=> 
    "Thanks baby. I'm a die hard monsterfan [email protected]: @ladygaga 's album speaks to me more than any other album ever. #diehardfan", 
    "in_reply_to_status_id_str"=>nil, 
    "entities"=> 
    {"hashtags"=>[{"indices"=>[115, 126], "text"=>"diehardfan"}], 
    "user_mentions"=> 
    [{"name"=>"Lady Gaga", 
     "indices"=>[50, 59], 
     "screen_name"=>"ladygaga", 
     "id_str"=>"14230524", 
     "id"=>14230524}], 
    "urls"=>[]}, 
    "in_reply_to_screen_name"=>nil, 
    "in_reply_to_user_id_str"=>nil, 
    "place"=>nil, 
    "coordinates"=>nil, 
    "truncated"=>false, 
    "source"=> 
    "<a href=\"http://blackberry.com/twitter\" rel=\"nofollow\">Twitter for BlackBerry\u00AE</a>", 
    "id_str"=>"93377358974812161", 
    "contributors"=>nil, 
    "retweeted"=>false, 
    "retweet_count"=>"100+", 
    "id"=>93377358974812161}, 
{"in_reply_to_status_id"=>nil, 
    "user"=> 
    {"time_zone"=>"Quito", 
    "protected"=>false, 
    "location"=>"New York, NY", 
    "listed_count"=>208144, 
    "following"=>false, 
    "profile_use_background_image"=>true, 
    "profile_background_image_url_https"=> 
    "https://si0.twimg.com/profile_background_images/203383875/Unnamed-1.jpg", 
    "name"=>"Lady Gaga", 
    "profile_background_color"=>"9AE4E8", 
    "url"=>"http://www.ladygaga.com", 
    "profile_image_url_https"=> 
    "https://si0.twimg.com/profile_images/1239447061/Unnamed-1_normal.jpg", 
    "default_profile"=>false, 
    "verified"=>true, 
    "profile_background_image_url"=> 
    "http://a1.twimg.com/profile_background_images/203383875/Unnamed-1.jpg", 
    "utc_offset"=>-18000, 
    "contributors_enabled"=>false, 
    "favourites_count"=>2, 
    "created_at"=>"Wed Mar 26 22:37:48 +0000 2008", 
    "default_profile_image"=>false, 
    "profile_text_color"=>"333333", 
    "profile_image_url"=> 
    "http://a1.twimg.com/profile_images/1239447061/Unnamed-1_normal.jpg", 
    "friends_count"=>142497, 
    "profile_sidebar_fill_color"=>"DDFFCC", 
    "description"=>"mother mons\u2020er\r\n", 
    "is_translator"=>false, 
    "show_all_inline_media"=>false, 
    "lang"=>"en", 
    "geo_enabled"=>false, 
    "profile_background_tile"=>true, 
    "followers_count"=>11781392, 
    "screen_name"=>"ladygaga", 
    "follow_request_sent"=>false, 
    "id_str"=>"14230524", 
    "profile_link_color"=>"0084B4", 
    "id"=>14230524, 
    "statuses_count"=>968, 
    "notifications"=>false, 
    "profile_sidebar_border_color"=>"BDDCAD"}, 
    "created_at"=>"Mon Jul 18 14:30:46 +0000 2011", 
    "geo"=>nil, 
    "in_reply_to_user_id"=>nil, 
    "favorited"=>false, 
    "text"=> 
    "http://twitpic.com/5s4f2h - Just left @HowardStern, rockers with long hair have a sweetspot for girls like me. He was a doll. :)", 
    "in_reply_to_status_id_str"=>nil, 
    "entities"=> 
    {"hashtags"=>[], 
    "user_mentions"=> 
    [{"name"=>"Howard Stern", 
     "indices"=>[38, 50], 
     "screen_name"=>"HowardStern", 
     "id_str"=>"246481013", 
     "id"=>246481013}], 
    "urls"=> 
    [{"url"=>"http://twitpic.com/5s4f2h", 
     "indices"=>[0, 25], 
     "expanded_url"=>nil}]}, 
    "in_reply_to_screen_name"=>nil, 
    "in_reply_to_user_id_str"=>nil, 
    "place"=>nil, 
    "coordinates"=>nil, 
    "truncated"=>false, 
    "source"=> 
    "<a href=\"http://blackberry.com/twitter\" rel=\"nofollow\">Twitter for BlackBerry\u00AE</a>", 
    "id_str"=>"92964531315294209", 
    "contributors"=>nil, 
    "retweeted"=>false, 
    "retweet_count"=>"100+", 
    "id"=>92964531315294209}, 
{"in_reply_to_status_id"=>nil, 
    "user"=> 
    {"follow_request_sent"=>false, 
    "time_zone"=>"Quito", 
    "protected"=>false, 
    "location"=>"New York, NY", 
    "show_all_inline_media"=>false, 
    "following"=>true, 
    "geo_enabled"=>false, 
    "profile_use_background_image"=>true, 
    "name"=>"Lady Gaga", 
    "default_profile"=>false, 
    "profile_background_color"=>"9AE4E8", 
    "url"=>"http://www.ladygaga.com", 
    "verified"=>true, 
    "profile_background_image_url"=> 
    "http://a1.twimg.com/profile_background_images/203383875/Unnamed-1.jpg", 
    "utc_offset"=>-18000, 
    "listed_count"=>208146, 
    "statuses_count"=>968, 
    "profile_background_image_url_https"=> 
    "https://si0.twimg.com/profile_background_images/203383875/Unnamed-1.jpg", 
    "favourites_count"=>2, 
    "created_at"=>"Wed Mar 26 22:37:48 +0000 2008", 
    "profile_text_color"=>"333333", 
    "profile_image_url_https"=> 
    "https://si0.twimg.com/profile_images/1239447061/Unnamed-1_normal.jpg", 
    "profile_image_url"=> 
    "http://a1.twimg.com/profile_images/1239447061/Unnamed-1_normal.jpg", 
    "profile_sidebar_fill_color"=>"DDFFCC", 
    "description"=>"mother mons\u2020er\r\n", 
    "contributors_enabled"=>false, 
    "lang"=>"en", 
    "profile_background_tile"=>true, 
    "followers_count"=>11781425, 
    "screen_name"=>"ladygaga", 
    "default_profile_image"=>false, 
    "id_str"=>"14230524", 
    "friends_count"=>142497, 
    "profile_link_color"=>"0084B4", 
    "id"=>14230524, 
    "is_translator"=>false, 
    "notifications"=>false, 
    "profile_sidebar_border_color"=>"BDDCAD"}, 
    "created_at"=>"Mon Jul 18 11:24:18 +0000 2011", 
    "geo"=>nil, 
    "in_reply_to_user_id"=>nil, 
    "favorited"=>false, 
    "text"=> 
    "SURPRISE MONSTERS! You can find a link to a more readable format of my V Mag Pop Culture Column on http://t.co/ekIJBXo My new blog!", 
    "in_reply_to_status_id_str"=>nil, 
    "entities"=> 
    {"user_mentions"=>[], 
    "urls"=> 
    [{"url"=>"http://t.co/ekIJBXo", 
     "display_url"=>"tinyurl.com/3p42npn", 
     "indices"=>[99, 118], 
     "expanded_url"=>"http://tinyurl.com/3p42npn"}], 
    "hashtags"=>[]}, 
    "in_reply_to_screen_name"=>nil, 
    "in_reply_to_user_id_str"=>nil, 
    "place"=>nil, 
    "coordinates"=>nil, 
    "truncated"=>false, 
    "source"=>"web", 
    "id_str"=>"92917605253386241", 
    "contributors"=>nil, 
    "retweeted"=>false, 
    "retweet_count"=>"100+", 
    "id"=>92917605253386241}, 
{"in_reply_to_status_id"=>nil, 
    "user"=> 
    {"contributors_enabled"=>false, 
    "time_zone"=>"Quito", 
    "protected"=>false, 
    "location"=>"New York, NY", 
    "default_profile"=>false, 
    "following"=>false, 
    "profile_use_background_image"=>true, 
    "name"=>"Lady Gaga", 
    "profile_background_color"=>"9AE4E8", 
    "url"=>"http://www.ladygaga.com", 
    "is_translator"=>false, 
    "default_profile_image"=>false, 
    "verified"=>true, 
    "profile_background_image_url_https"=> 
    "https://si0.twimg.com/profile_background_images/203383875/Unnamed-1.jpg", 
    "profile_background_image_url"=> 
    "http://a1.twimg.com/profile_background_images/203383875/Unnamed-1.jpg", 
    "utc_offset"=>-18000, 
    "show_all_inline_media"=>false, 
    "favourites_count"=>2, 
    "created_at"=>"Wed Mar 26 22:37:48 +0000 2008", 
    "friends_count"=>142497, 
    "geo_enabled"=>false, 
    "profile_text_color"=>"333333", 
    "profile_image_url"=> 
    "http://a1.twimg.com/profile_images/1239447061/Unnamed-1_normal.jpg", 
    "follow_request_sent"=>false, 
    "profile_sidebar_fill_color"=>"DDFFCC", 
    "description"=>"mother mons\u2020er\r\n", 
    "lang"=>"en", 
    "profile_background_tile"=>true, 
    "followers_count"=>11781014, 
    "screen_name"=>"ladygaga", 
    "profile_image_url_https"=> 
    "https://si0.twimg.com/profile_images/1239447061/Unnamed-1_normal.jpg", 
    "id_str"=>"14230524", 
    "profile_link_color"=>"0084B4", 
    "id"=>14230524, 
    "listed_count"=>208145, 
    "statuses_count"=>968, 
    "notifications"=>false, 
    "profile_sidebar_border_color"=>"BDDCAD"}, 
    "created_at"=>"Mon Jul 18 10:35:37 +0000 2011", 
    "geo"=>nil, 
    "in_reply_to_user_id"=>nil, 
    "favorited"=>false, 
    "text"=> 
    "http://twitpic.com/5s1f29 - If you need a quick fashion read, here's my V Mag column for the month. This time we did a Triptych!", 
    "in_reply_to_status_id_str"=>nil, 
    "entities"=> 
    {"hashtags"=>[], 
    "user_mentions"=>[], 
    "urls"=> 
    [{"url"=>"http://twitpic.com/5s1f29", 
     "indices"=>[0, 25], 
     "expanded_url"=>nil}]}, 
    "in_reply_to_screen_name"=>nil, 
    "in_reply_to_user_id_str"=>nil, 
    "place"=>nil, 
    "coordinates"=>nil, 
    "truncated"=>false, 
    "source"=> 
    "<a href=\"http://blackberry.com/twitter\" rel=\"nofollow\">Twitter for BlackBerry\u00AE</a>", 
    "id_str"=>"92905355444621313", 
    "contributors"=>nil, 
    "retweeted"=>false, 
    "retweet_count"=>"100+", 
    "id"=>92905355444621313}, 
{"in_reply_to_status_id"=>nil, 
    "user"=> 
    {"time_zone"=>"Quito", 
    "protected"=>false, 
    "location"=>"New York, NY", 
    "is_translator"=>false, 
    "following"=>true, 
    "profile_use_background_image"=>true, 
    "profile_background_image_url_https"=> 
    "https://si0.twimg.com/profile_background_images/203383875/Unnamed-1.jpg", 
    "name"=>"Lady Gaga", 
    "follow_request_sent"=>false, 
    "friends_count"=>142497, 
    "profile_background_color"=>"9AE4E8", 
    "url"=>"http://www.ladygaga.com", 
    "default_profile"=>false, 
    "verified"=>true, 
    "profile_background_image_url"=> 
    "http://a1.twimg.com/profile_background_images/203383875/Unnamed-1.jpg", 
    "utc_offset"=>-18000, 
    "show_all_inline_media"=>false, 
    "favourites_count"=>2, 
    "created_at"=>"Wed Mar 26 22:37:48 +0000 2008", 
    "profile_text_color"=>"333333", 
    "profile_image_url"=> 
    "http://a1.twimg.com/profile_images/1239447061/Unnamed-1_normal.jpg", 
    "listed_count"=>208145, 
    "profile_sidebar_fill_color"=>"DDFFCC", 
    "description"=>"mother mons\u2020er\r\n", 
    "lang"=>"en", 
    "geo_enabled"=>false, 
    "profile_background_tile"=>true, 
    "followers_count"=>11780972, 
    "screen_name"=>"ladygaga", 
    "profile_image_url_https"=> 
    "https://si0.twimg.com/profile_images/1239447061/Unnamed-1_normal.jpg", 
    "id_str"=>"14230524", 
    "statuses_count"=>968, 
    "profile_link_color"=>"0084B4", 
    "id"=>14230524, 
    "default_profile_image"=>false, 
    "contributors_enabled"=>false, 
    "notifications"=>false, 
    "profile_sidebar_border_color"=>"BDDCAD"}, 
    "created_at"=>"Sun Jul 17 22:50:49 +0000 2011", 
    "geo"=>nil, 
    "in_reply_to_user_id"=>nil, 
    "favorited"=>false, 
    "text"=> 
    "I'm live with @howardstern 2moro morning on Sirius XM. Big fan. Gonna sing my face off, and talk shit w the raddest Hair in radio. 8am EDT", 
    "in_reply_to_status_id_str"=>nil, 
    "entities"=> 
    {"hashtags"=>[], 
    "user_mentions"=> 
    [{"name"=>"Howard Stern", 
     "indices"=>[14, 26], 
     "screen_name"=>"HowardStern", 
     "id_str"=>"246481013", 
     "id"=>246481013}], 
    "urls"=>[]}, 
    "in_reply_to_screen_name"=>nil, 
    "in_reply_to_user_id_str"=>nil, 
    "place"=>nil, 
    "coordinates"=>nil, 
    "truncated"=>false, 
    "source"=> 
    "<a href=\"http://blackberry.com/twitter\" rel=\"nofollow\">Twitter for BlackBerry\u00AE</a>", 
    "id_str"=>"92727984666066944", 
    "contributors"=>nil, 
    "retweeted"=>false, 
    "retweet_count"=>"100+", 
    "id"=>92727984666066944}, 
{"retweeted_status"=> 
    {"in_reply_to_status_id"=>nil, 
    "user"=> 
    {"time_zone"=>"Central Time (US & Canada)", 
     "protected"=>false, 
     "profile_image_url_https"=> 
     "https://si0.twimg.com/profile_images/1395256604/DSCN06191_normal.jpg", 
     "location"=>"USA", 
     "default_profile_image"=>false, 
     "show_all_inline_media"=>false, 
     "following"=>false, 
     "geo_enabled"=>true, 
     "profile_use_background_image"=>true, 
     "name"=>"John Marshall", 
     "contributors_enabled"=>false, 
     "profile_background_color"=>"709397", 
     "url"=>nil, 
     "is_translator"=>false, 
     "verified"=>false, 
     "profile_background_image_url"=> 
     "http://a1.twimg.com/images/themes/theme6/bg.gif", 
     "utc_offset"=>-21600, 
     "follow_request_sent"=>false, 
     "statuses_count"=>849, 
     "favourites_count"=>0, 
     "created_at"=>"Mon Mar 07 03:52:21 +0000 2011", 
     "friends_count"=>423, 
     "profile_text_color"=>"333333", 
     "profile_image_url"=> 
     "http://a0.twimg.com/profile_images/1395256604/DSCN06191_normal.jpg", 
     "profile_sidebar_fill_color"=>"A0C5C7", 
     "description"=> 
     "420 #BoardsofCanada #GLP #iamamiwhoami #M\u00FCtterMons\u2020re Say what you say, do what you do, feel what you feel, as long as it's real.", 
     "lang"=>"en", 
     "profile_background_tile"=>false, 
     "followers_count"=>583, 
     "screen_name"=>"Karczochy", 
     "listed_count"=>5, 
     "id_str"=>"261997342", 
     "profile_link_color"=>"FF3300", 
     "id"=>261997342, 
     "default_profile"=>false, 
     "notifications"=>false, 
     "profile_background_image_url_https"=> 
     "https://si0.twimg.com/images/themes/theme6/bg.gif", 
     "profile_sidebar_border_color"=>"86A4A6"}, 
    "created_at"=>"Sun Jul 17 21:36:45 +0000 2011", 
    "geo"=>nil, 
    "in_reply_to_user_id"=>nil, 
    "favorited"=>false, 
    "text"=> 
    "LOL. That's gonna be..interesting..RT @jeff1317 Howard Stern is back tomorrow and @ladygaga is a guest! Should make for great radio!", 
    "in_reply_to_status_id_str"=>nil, 
    "entities"=> 
    {"hashtags"=>[], 
     "user_mentions"=> 
     [{"name"=>"Jeff", 
     "indices"=>[38, 47], 
     "screen_name"=>"jeff1317", 
     "id_str"=>"22542097", 
     "id"=>22542097}, 
     {"name"=>"Lady Gaga", 
     "indices"=>[82, 91], 
     "screen_name"=>"ladygaga", 
     "id_str"=>"14230524", 
     "id"=>14230524}], 
     "urls"=>[]}, 
    "in_reply_to_screen_name"=>nil, 
    "in_reply_to_user_id_str"=>nil, 
    "place"=>nil, 
    "coordinates"=>nil, 
    "truncated"=>false, 
    "source"=> 
    "<a href=\"http://twitter.com/#!/download/ipad\" rel=\"nofollow\">Twitter for iPad</a>", 
    "id_str"=>"92709349004279809", 
    "contributors"=>nil, 
    "retweeted"=>false, 
    "retweet_count"=>"100+", 
    "id"=>92709349004279809}, 
    "in_reply_to_status_id"=>nil, 
    "user"=> 
    {"time_zone"=>"Quito", 
    "protected"=>false, 
    "profile_image_url_https"=> 
    "https://si0.twimg.com/profile_images/1239447061/Unnamed-1_normal.jpg", 
    "location"=>"New York, NY", 
    "default_profile_image"=>false, 
    "show_all_inline_media"=>false, 
    "following"=>false, 
    "geo_enabled"=>false, 
    "profile_use_background_image"=>true, 
    "name"=>"Lady Gaga", 
    "contributors_enabled"=>false, 
    "profile_background_color"=>"9AE4E8", 
    "url"=>"http://www.ladygaga.com", 
    "is_translator"=>false, 
    "verified"=>true, 
    "profile_background_image_url"=> 
    "http://a1.twimg.com/profile_background_images/203383875/Unnamed-1.jpg", 
    "utc_offset"=>-18000, 
    "follow_request_sent"=>false, 
    "statuses_count"=>968, 
    "favourites_count"=>2, 
    "created_at"=>"Wed Mar 26 22:37:48 +0000 2008", 
    "friends_count"=>142497, 
    "profile_text_color"=>"333333", 
    "profile_image_url"=> 
    "http://a1.twimg.com/profile_images/1239447061/Unnamed-1_normal.jpg", 
    "profile_sidebar_fill_color"=>"DDFFCC", 
    "description"=>"mother mons\u2020er\r\n", 
    "lang"=>"en", 
    "profile_background_tile"=>true, 
    "followers_count"=>11781095, 
    "screen_name"=>"ladygaga", 
    "listed_count"=>208145, 
    "id_str"=>"14230524", 
    "profile_link_color"=>"0084B4", 
    "id"=>14230524, 
    "default_profile"=>false, 
    "notifications"=>false, 
    "profile_background_image_url_https"=> 
    "https://si0.twimg.com/profile_background_images/203383875/Unnamed-1.jpg", 
    "profile_sidebar_border_color"=>"BDDCAD"}, 
    "created_at"=>"Sun Jul 17 21:38:16 +0000 2011", 
    "geo"=>nil, 
    "in_reply_to_user_id"=>nil, 
    "favorited"=>false, 
    "text"=> 
    "RT @Karczochy: LOL. That's gonna be..interesting..RT @jeff1317 Howard Stern is back tomorrow and @ladygaga is a guest! Should make for g ...", 
    "in_reply_to_status_id_str"=>nil, 
    "entities"=> 
    {"hashtags"=>[], 
    "user_mentions"=> 
    [{"name"=>"John Marshall", 
     "indices"=>[3, 13], 
     "screen_name"=>"Karczochy", 
     "id_str"=>"261997342", 
     "id"=>261997342}, 
     {"name"=>"Jeff", 
     "indices"=>[53, 62], 
     "screen_name"=>"jeff1317", 
     "id_str"=>"22542097", 
     "id"=>22542097}, 
     {"name"=>"Lady Gaga", 
     "indices"=>[97, 106], 
     "screen_name"=>"ladygaga", 
     "id_str"=>"14230524", 
     "id"=>14230524}], 
    "urls"=>[]}, 
    "in_reply_to_screen_name"=>nil, 
    "in_reply_to_user_id_str"=>nil, 
    "place"=>nil, 
    "coordinates"=>nil, 
    "truncated"=>true, 
    "source"=> 
    "<a href=\"http://blackberry.com/twitter\" rel=\"nofollow\">Twitter for BlackBerry\u00AE</a>", 
    "id_str"=>"92709727896735745", 
    "contributors"=>nil, 
    "retweeted"=>false, 
    "retweet_count"=>"100+", 
    "id"=>92709727896735745}, 
+0

很酷。你如何获得CSS样式? –

+0

@Justin你如何解释你正在尝试做什么。你想要什么CSS样式?你试图欺骗Twitter的外观和标记自己? – Phrogz

+0

基本上我试图框架网站哈哈。我不认为他们允许它(他们使用javascript打开任何iframe),我试图找到解决方法。 –