Scraping an AngularJS application

前端 未结 2 1539
后悔当初
后悔当初 2021-01-07 07:50

I\'m scrapping some HTML pages with Rails, using Nokogiri.

I had some problems when I tried to scrap an AngularJS page because the gem is opening the HTML before it

2条回答
  •  我在风中等你
    2021-01-07 08:27

    You can use:

    require 'phantomjs'
    require 'watir'
    
    b = Watir::Browser.new(:phantomjs)
    b.goto URL
    
    doc = Nokogiri::HTML(b.html)
    

    Download phantomjs in http://phantomjs.org/download.html and move the binary for /usr/bin

提交回复
热议问题