Using a CSS Selector to locate some data stored in a javascript element -


i doing web scraping (with ok of site owner ) , have come across data updated when slider moved.

problem data inside javascript. using perl web::scraper allows both css selectors , xpath selectors can't seem able isolate javascript.

i have tried attribute selectors; script[src="path_to.js"] plain node selectors 'script' , absolute css path - did not want work @ all.

any ideas how content of script node?

try html::query

use html::query ();  # raw (unparsed) content of page $content. # eg: $mech->content or similar $content = qq|     <html>         <head>             <script type="text/javascript">                 function init() {                     var x = [1,2,3,4,5,6,7];                     alert(x);                 }             </script>         </head>         <body onload="init()">         </body>     </html> |;  # css selector  ----------------------vvvvv ($e) = html::query::query(text => $content, 'script');  die "couldn't find script element!\n" unless defined $e;  # can't use as_text or as_trimmed_text html::element print $e->as_xml."\n";  

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -