in reply to Seek Perl equivalent to DOM Inspector

I have investigated WWW::Scripter and been in communication with that library's author, Father Chrysostomos. But this is proving a tough nut to crack. Let me give another example:

Slightly obfuscated and simplified source code:
$ cat source.html <html> <head></head> <body> <script src="http://bs.example.com/SmashingPumpkin/adServer.bs?cn=rsb&c=28&pli +=8064559&PluID=0&w=336&h=280&ord=[RANDOM_NUMBER]&ucm=true"></script> <noscript> <a href="http://bs.example.com/SmashingPumpkin/adServer.bs?cn=brd&FlightI +D=8064559&Page=&PluID=0&Pos=1510952713" target="_blank"><img src="http://bs.example.com/SmashingPumpkin/adServer.bs?cn=bsr&FlightID +=8064559&Page=&PluID=0&Pos=1510952713" border=0 width=336 height=280></a> </noscript> </body> </html>

What I see in Safari Web Inspector (trimmed, obfuscated)

$ cat formatted.html <html><head></head> <body> <script src="http://bs.example.com/SmashingPumpkin/adServer.bs?cn=rsb&amp;c=28 +&amp;pli=8064559&amp;PluID=0&amp;w=336&amp;h=280&amp;ord=[RANDOM_NUMB +ER]&amp;ucm=true"></script> <div id="ebDiv850954202003777" dir="ltr" style="display: inline; width: 336px; height: 280px; margin: 0px auto; "> <div id="ebStdBannerDiv_16672157_850954202003777" dir="ltr" style="border: 0px; padding: 0px; margin: 0px; top: 0px; left: 0px; overflow: visible; font-size: 0px; line-height: 0px; text-align: left; width: 336px; height: 280px; display: inline; "> <object id="ebStdBannerFlash_16672157_850954202003777" dir="ltr" name="ebStdBannerFlash_16672157_850954202003777" style="border:0px; padding:0px; margin:0px; text-align:left +; width:336px; height:280px; " codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swfl +ash.cab#" version="8,0,0,0" type="application/x-shockwave-flash" data="http://ds.example.com/BurstingRes//Site-23100/Type-2/9bcc2f07-af +05-4f07-a0f0-ca803d331bd4.swf"> ...

My object is to be able to pluck out either of the last two lines -- 'type' or 'data' -- you see above.

Using WWW::Scripter, I called:

$scripter->use_plugin("JavaScript"); my $doc = $scripter->document(); say STDERR Dumper $doc;
The latter call resulted in 23,500+ lines in Data::Dumper output -- yet nowhere in there could I find the strings 'swf', 'shockwave' or 'flash'. So I couldn't be sure if the code was executing the script at all.

Suggestions?

Thank you very much.

Jim Keenan

Replies are listed 'Best First'.
Re^2: Seek Perl equivalent to DOM Inspector
by Anonymous Monk on Oct 02, 2013 at 07:22 UTC

    Suggestions?

    :) Get serious?

    $scripter->use_plugin("JavaScript"); my $doc = $scripter->document(); say STDERR Dumper $doc; __END__ Can't call method "use_plugin" on an undefined value at - line 1.

    Even if I were to fill in the missing blanks from that code snippet, all the html/javascript/website stuff is bogus too

    Maybe all you need is WWW::Scripter::Plugin::Ajax but I wouldn't be surprised if that doesn't fix anything :) writing a DOM+JS is tricky