There is an HTML file, in the body of which there is a js script, which in turn has a variable(highlighted in the photo below) that stores an array of objects.

The task is to use Ruby to get this HTML by reference, and then somehow get to the cherished variable and get the array stored in it and load it into the Ruby variable for further work.
What would you recommend to use to get HTML data in Ruby?
What is the best way to get to this variable(by searching for a string by the name of a variable? Or are there any other options?)
In general, can anyone come across such a problem, help than you can ^ __ ^

2 Answers 2

But the article how to parse on Ruby can be done with whores and blackjack: D
For example, using Selenium WebDriver.
driver=Selenium :: WebDriver.for: chrome
result=driver.execute_script'return Ya._metrika.hitId;'
puts result

The example above will get the value of `JavaScript` variable` Ya._metrika.hitId`, created on the page
In your case, `attributesCombinations` needs to get.

Another option is to use the JavaScript parser.
For example, or any similar one.
Get the JavaScript source code from the page and feed it to the parser.
Getting the code is easy.
doc=Nokogiri :: HTML response.raw_body
element=doc.at_css'script'#need a more precise selector here
element.text #will give you raw javascript