【问题标题】:Trouble with parsing source html with Nokogiri使用 Nokogiri 解析源 html 时遇到问题
【发布时间】:2011-07-21 05:19:42
【问题描述】:

我正在尝试使用 nokogiri 选择一个 DOM 元素,但它似乎返回一个空数组。

我运行这段代码:

require "open-uri"
require "nokogiri"

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

它会返回 Nokogiri 解析的整个源代码。

但是,当我运行时

doc.css(".stream-tweet")

它返回一个空数组。 .stream-tweethttp://twitter.com/#!/ladygaga 的多个 div 元素的类,我通过检查源代码发现。

这是怎么回事?

【问题讨论】:

    标签: html ruby-on-rails parsing screen-scraping nokogiri


    【解决方案1】:

    因为如果您查看doc,则没有具有stream-tweet 类的div 元素。
    该 div 之后会通过对 twitter api 的 AJAX 请求加载。

    【讨论】:

    • 有没有办法让doc 格式更好?另外,“之后通过 javascript twitter api 加载实际 div”到底是什么意思。
    • nokogiri 无法做到这一点,因为 nokogiri 无法解析 ajax 请求的结果。你为什么需要它?也许你可以使用 twitter api。
    • @Justin NARKOZ 的意思是,如果您“查看源代码”(并且不检查元素),您将看到您声称存在的 HTML 在该 URL 的原始 HTTP 响应中不存在.相反,JavaScript 代码在站点上运行,并最终从它发出的 11 个(!)不同的 XHR JSON 请求之一接收内容。然后,JavaScript 在页面上使用类动态构建元素。 Nokogiri 不是完整的网络浏览器,也不运行 JavaScript。
    • @Phrogz ahhhh 好的,这很有意义。
    • @Justin 查找“无头浏览器”。另请参阅 MechanizeJohnsonSelenium RC
    【解决方案2】:

    @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 RT@GSp0nz: @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 看起来像一个 Ruby 哈希数组(因堆栈溢出而被截断):

    [{"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 RT@GSp0nz: @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},
    

    【讨论】:

    • @Justin 你解释一下你想做什么怎么样。你想要什么 CSS 样式?您是否在尝试欺骗自己的 Twitter 外观和标记?
    • 基本上我正在尝试构建站点大声笑。我认为他们不允许这样做(他们使用 javascript 破坏任何 iframe),我正在尝试找到解决方法。
    猜你喜欢
    • 2013-09-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-08
    • 1970-01-01
    • 2014-02-24
    • 2018-04-25
    • 2011-12-07
    相关资源
    最近更新 更多