Adds skyward

This commit is contained in:
Nemo 2018-10-05 02:33:22 +05:30
parent 7ba16ddb9f
commit 9a0a096896
2 changed files with 35 additions and 0 deletions

1
.gitignore vendored
View File

@ -1,5 +1,6 @@
/wok/*.html
/wor/*.html
/skyward/*.html
/oathbringer/*.html
/wok-prime/*.html
/edgedancer/*.html

34
skyward.rb Normal file
View File

@ -0,0 +1,34 @@
require 'fileutils'
require 'nokogiri'
require_relative './methods'
FileUtils.mkdir_p('skyward')
BASE = 'https://www.getunderlined.com'.freeze
links = [
'/read/excerpt-reveal-start-reading-skyward-by-brandon-sanderson/'
]
episode = 1
links.each do |link|
url = BASE + link
puts "Download #{url}"
unless File.exist? "skyward/#{episode}.html"
`wget --no-clobber "#{url}" --output-document "skyward/#{episode}.html"`
end
episode += 1
end
html = ''
for i in 1..(links.length)
complete_html = Nokogiri::HTML(open("skyward/#{i}.html"))
page = complete_html.css('article')[0]
html += page.inner_html
end
File.open('books/skyward.html', 'w') { |file| file.write(html) }
puts '[html] Generated HTML file'
generate('skyward', :all)