Last active
January 4, 2016 05:59
-
-
Save TheRusskiy/8578503 to your computer and use it in GitHub Desktop.
Save all ngdocs links to a file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
save_path = 'c:\links.html' | |
require 'capybara' | |
Capybara.current_driver = :selenium | |
include Capybara::DSL | |
visit 'http://docs.angularjs.org/api/' | |
def to_static link | |
link.sub 'docs.angularjs.org', 'docs.angularjs.org/?_escaped_fragment_=' | |
end | |
links = all('.api-list-item.nav-list a').map do |e| | |
"<a href=\"#{to_static(e[:href])}\"> #{e.text.strip}</a>" | |
end | |
f = File.open save_path, 'w' | |
f.write(links*"\n") | |
f.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment