If I read correctly, are you trying to parse JavaScript and get a Ruby array with your image urls?
Nokogiri only parses HTML / XML, so you need another library; In a cursory search, the RKelly library appears , which has a parse function that accepts a JavaScript string and returns a parse tree.
When you have a parsing tree, you will need to go through it and find the nodes of interest by name (for example, _arPic ), then get the contents of the line on the other side of the job.
Alternatively, if it should not be too reliable (and it is not), you can simply use a regular expression to search for JavaScript, if possible:
/^\s*_arPic\[\d\] = "(.+)";$/
may be a good older regular expression.
source share