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 4552632
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T16:49:19+00:00 2026-05-21T16:49:19+00:00

I have used hpricot before for grabing content from websites that are within some

  • 0

I have used hpricot before for grabing content from websites that are within some HTML tags however I am trying to build an array of all the flashvars found on this page http://view-source:http://megavideo.com/?v=014U2YO9

require 'hpricot'
require 'open-uri'

flashvars = Array.new
doc = Hpricot(open("http://megavideo.com/?v=014U2YO9"))

for flashvars in (doc/"/param[@name='flashvars']") do
  flashvars << flashvar
end

I have been trying with the above code snippet, hopefully I was on the right tracks, would anyone be able to help me further?

Thankyou

  • 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-21T16:49:20+00:00Added an answer on May 21, 2026 at 4:49 pm

    You have used syntax indicating that you are trying to fetch attributes from <param> elements, but no such markup exists on that page. There are a plethora of JavaScript assignments to properties of a flashvar object. Assuming that these are what you want, you don’t need Hpricot, just a regex for the JS. This seems to work:

    require 'open-uri'
    html = open("http://megavideo.com/?v=014U2YO9").read
    
    flashvars = Hash[ html.scan( /flashvars\.(\w+)\s*=\s*["']?(.+?)["']?;/ ) ]
    
    require 'pp' # Just for pretty output here
    pp flashvars
    
    #=> {"logintxt"=>"Login",
    #=>  "registertxt"=>"Register",
    #=>  "searchtxt"=>"Search videos",
    #=>  "searchrestxt"=>"\"",
    #=>  "useSystemFont"=>"0",
    #=>  "size"=>"17",
    #=>  "loginAct"=>"?c=login%26next%3Dv%253D014U2YO9",
    #=>  "registerAct"=>"?c=signup",
    #=>  "userAct"=>"?c=account",
    #=>  "signoutAct"=>"javascript:signout()",
    #=>  "myvideostxt"=>"My Videos",
    #=>  "videosAct"=>"?c=myvideos",
    #=>  "added"=>"2011-04-14",
    #=>  "username"=>"beenerkeekee19952",
    #=>  etc.
    

    Note that this leaves all values as strings in Ruby, even values that were numbers in JavaScript. As it strips off leading/trailing quote marks for the JavaScript strings, the result is that you cannot discern flashvars.foo = 42; from flashvars.bar = "42";.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have used several different scripts that people have suggested for trying to parse
We have used Infragistics controls in our applications for years. However, we have always
I have used full text search mysql. My code is select * from uh_property
I have used ASP.NET Web Services (.asmx) in the past. However, I have heard
I have used 3 some jquery related files namely <script type=text/javascript src=/blog/jquery/jquery-1.7.1.min.js></script> <link type=text/css
I have used several looking glass tools from servers around the world. What I'm
I have used an expander control to create some sort of slide-out panel which
I have used the ddlgen tool to export the database schemas from my DEV
We have used Custom List View inside that one Text View and two Edit
I have used git update-index --assume-unchanged on some files to keep my changes to

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.