Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^4: Project Help: Mechanize::Firefox - Scraping Websites with Javascript

by jdlev (Scribe)
on Sep 23, 2014 at 15:43 UTC ( [id://1101671]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Project Help: Mechanize::Firefox - Scraping Websites with Javascript
in thread Project Help: Mechanize::Firefox - Scraping Websites with Javascript

No Worries. I think it was actually my fault. Let me ask you this. This variable "packagedContests" has literally thousands of child Objects associated with it. Is there someway to store the variable as a hex, and then iterate through it to break it apart? Also...FWIW...this is the DOM object that I found that was associated with the variable using firebug. It lists the following elements within each Object. The bigger problem is this is just one collection of about 2k of these objects I'll need to eventually parse through. Using my console, I'm able to select the specific elements of each object with the following code: packageContests[0].n Any Thoughts?

a 27 attr Object { IsGuaranteed="true", IsStarred="true"} ec 0 fpp 108 fwt false id 1141705 isOwner false m 92400 mec 999999 n "NFL $2.2M Millionaire Maker [$1,000,000 to 1st!]" nt 3481 po 2200000 pt 1 rl false rlc 0 rll 9999 s 1 sa false sd "/Date(1412528400000)/" sdstring "Sun 1:00PM" so -99999999 startTimeType 0 tix false tmpl 28934 uc 0 ulc 0
I love it when a program comes together - jdhannibal
  • Comment on Re^4: Project Help: Mechanize::Firefox - Scraping Websites with Javascript
  • Download Code

Replies are listed 'Best First'.
Re^5: Project Help: Mechanize::Firefox - Scraping Websites with Javascript
by Corion (Patriarch) on Sep 23, 2014 at 16:51 UTC

    What do you mean by "a hex"?

    You will need to learn Javascript and understand how Javscript types map to Perl.

    If you mean to access packageContests[0].n instead of packageContests.n, that means you need to do it different on the Perl side as well. You will need to treat packageContests as array reference instead of a hash reference:

    print $packageContests->[0]->{n};

    The data structures are mapped between Perl and Javascript, but you will need to understand the data structure itself to make use of it.

      Sorry, I meant hash, and your solution worked! :)

      Thank you Thank You THANK YOU!!! You will receive many votes :)

      I love it when a program comes together - jdhannibal

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1101671]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-25 13:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found