Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7656199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T12:42:22+00:00 2026-05-31T12:42:22+00:00

Revised (clarified question) I’ve spent a few days already trying to figure out how

  • 0

Revised (clarified question)

I’ve spent a few days already trying to figure out how to scrape specific information from a facebook game; however, I’ve run into brick wall after brick wall. As best as I can tell, the main problem is as follows. I can use Chrome’s inspect element tool to manually find the html that I need – it appears nestled inside an iframe. However, when I try and scrape that iframe, it is empty (except for properties):

<iframe id="game_frame" name="game_frame" src="" scrolling="no" ...></iframe>

This is the same output that I see if I use a browsers “View page source” tool.
I don’t understand why I can’t see the data in the iframe. The answer is NOT that it’s being added afterwards by AJAX. (I know that both because “View page source” can read data that’s been added by Ajax and also because I’ve b/c I’ve waited until after I can see the data page before scraping it and it’s still not there).

Is this happening because of facebook’s anti-screen scraping, and if so is there a way around it? Or am I just missing something. I program in ruby and I’ve tried nokogiri, then mechanize, then capybara without success.

I don’t know if it makes any difference, but it seems to me that the iframe is getting it’s data using the iframe’s “game_frame” reference which apparently refers to this piece of html that appears earlier in the document:

<form id="hidden_login_form_1331840407" action="" method="POST" target="game_frame">
  <input type="hidden" name="signed_request" autocomplete="off" value="v6kIAsKTZa...">
  ...
</form>

Original question

I wrote a ruby program that uses nokogiri to scrape data from a facebook game’s HTML. Currently, I get the HTML by using chrome’s “inspect element” tool and I save it to a file and parse it from there. However, I would really like to be able to access the information from within ruby. For example, I would pass the program the page name “www.gamename.com/…?id=12345” and it would login to facebook, go to that page and scrape the data. Currently, if I try that, it doesn’t work because I get redirected to facebook’s login page. How can I get past the login screen to access the page(s) I need?

I would like to do this using the nokogiri code that I have already written; however, if I have to I could rewrite it using something else. Currently, the program is a standalone program – not a rails program – but I could change that. I’ve see some information that might point me in the direction of Omniauth but I’m not sure that’s what I’m looking for and it also looks very complicated. I’m hoping there’s a simpler solution.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T12:42:24+00:00Added an answer on May 31, 2026 at 12:42 pm

    I can recommend capybara-webkit for this kind of task. It uses QtWebkit under the hood and understands Javascript:

    require 'capybara-webkit'
    require 'capybara/dsl'
    require 'nokogiri'
    
    include Capybara::DSL
    Capybara.current_driver = :webkit
    
    # login
    visit("https://www.facebook.com")
    find("#email").set("user")
    find("#pass").set("password")
    find("#loginbutton//input").click
    
    # navigate to the JS-generated page
    visit("www.gamename.com/...?id=12345")
    
    # parse HTML
    doc = Nokogiri::HTML.parse(body)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay this is a revised question from earlier today, I have included code to
REVISED QUESTION : We have tracked this down to a custom add to cart
I followed RailsCasts authentication from scratch (http://railscasts.com/episodes/250-authentication-from-scratch-revised) using the bcrypt-ruby gem and have the
UPDATE: Solved. Thanks BusyMark! EDIT: This is revised based on the answer below from
* revised, but still not solved...* I want to combine data from two files
[revised] I'm creating a TreePanel in ExtJs that is loading its children from a
This is a revised/better written version of the question I asked earlier today --
REVISED QUESTION I realize using the response to: $facebook->api('/me?access_token='.$access_token) will determine whether you need
REVISED QUESTION: have an xml document, i wish to change the qty of a
NOTE: I completely revised the question and turned it into an example project specifically

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.