c# - Scrape JavaScript array data with CsQuery -


The page that I want to scrape is within JavaScript. It looks like this pattern:

  & lt; Script type = "text / javascript" & gt; Array name ["field 1"] = 12; Array name ["field2"] = 42; Array name ["field 3"] = 1442; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; Array name ["field 4"] = 62; Array name ["field 5"] = 3; Array name ["field 6"] = 542; & Lt; / Script & gt;  

It is mixed with the hell of many other JavaScript I need to get these values.

I started this:

  var dom = CQ.CreateFromUrl ("http://somesite.xxx"); CQ script = DOM ["script [type = 'text / javascript']"];  

But I can not think of how to increase this data. Is this the only way to make a rajx and loop on everything else or is there any other way that is performing better?

How can I use CSS selectors for the actual Javascript code? Should I try a different approach?

It seems that you are actually looking for a server-side JavaScript engine - CSAP will be easy for you. You can get the content of the script's content from, but then you really need to run the script and then be able to mention the organizations that have been created. While in theory a line of scripts can create a query language, the reality is that it is operating in the original. If you only need to draw simple work, and the context is not important, then you are probably looking at anything as simple as regular expression (or even grep), which you need You can filter.

I have used the Nevis V8 wrapper - also on the knees as a neosys. Javascript

This is anything faster (since it uses Google's V8 engine under the hood); The only real result is that it is a pure. NET is not a solution, but once it is very painless to install it is an example of using it in my project which it uses to run JSHIT.

100% .NET JavaScript engine such as Jint, IronJS and Jurassic I have used Jurassic earlier and it is probably the fastest because it compiles the BteTode, it is surprisingly complete, but in fact it is not being actively developed, and therefore it will probably be difficult to get very support. But they are much slower than all V8s, and do not provide any real benefits other than having no non-net references.

Unless you really need to actually be 100%, then just use JavscriptDotNet.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -