Adds edgedancer
This commit is contained in:
parent
9897150002
commit
8514e43064
|
@ -1,4 +1,5 @@
|
|||
/wok/*.html
|
||||
/wor/*.html
|
||||
/oathbringer/*.html
|
||||
/edgedancer/*.html
|
||||
/books/*
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 38 KiB |
Binary file not shown.
|
@ -0,0 +1,50 @@
|
|||
require 'date'
|
||||
require 'fileutils'
|
||||
require 'nokogiri'
|
||||
require_relative './methods'
|
||||
|
||||
FileUtils.mkdir_p('edgedancer')
|
||||
|
||||
BASE = 'https://www.tor.com/'.freeze
|
||||
|
||||
links = [
|
||||
"2017/08/24/edgedancer-reread-chapter-1/",
|
||||
"2017/08/31/edgedancer-reread-chapter-2/",
|
||||
"2017/09/07/edgedancer-reread-chapters-3-and-4/",
|
||||
"2017/09/14/edgedancer-reread-chapters-5-and-6/"
|
||||
]
|
||||
|
||||
episode = 1
|
||||
|
||||
links.each do |link|
|
||||
url = BASE + link
|
||||
puts "Download #{url}"
|
||||
unless File.exist? "edgedancer/#{episode}.html"
|
||||
`wget --no-clobber "#{url}" --output-document "edgedancer/#{episode}.html" -o /dev/null`
|
||||
end
|
||||
episode += 1
|
||||
end
|
||||
|
||||
# Now we have all the files
|
||||
html = ''
|
||||
for i in 1..(links.length)
|
||||
complete_html = Nokogiri::HTML(open("edgedancer/#{i}.html"))
|
||||
page = complete_html.css('.entry-content')
|
||||
title = complete_html.css('.entry-title>a').inner_html
|
||||
ending = false
|
||||
page.children.each do |e|
|
||||
ending = true if e.class? 'squib'
|
||||
e.remove if ending
|
||||
end
|
||||
html += "<h1>#{title}</h1>"
|
||||
html += page.inner_html
|
||||
|
||||
url = BASE + links[i - 1]
|
||||
|
||||
html += "<p>Visit <a href='#{url}'>tor.com</a> for discussion.</p>"
|
||||
end
|
||||
|
||||
File.open('books/edgedancer-reread.html', 'w') { |file| file.write(html) }
|
||||
puts '[html] Generated HTML file'
|
||||
|
||||
generate('edgedancer-reread', :all)
|
|
@ -0,0 +1,5 @@
|
|||
<dc:title id="epub-title-1">Edgedancer Reread</dc:title>
|
||||
<dc:date>2017-09-14</dc:date>
|
||||
<dc:language>en-US</dc:language>
|
||||
<dc:creator id="epub-creator-1" opf:role="aut">Alice Arneson</dc:creator>
|
||||
<dc:creator id="epub-creator-1" opf:role="aut">Lyndsey Luther</dc:creator>
|
|
@ -94,7 +94,7 @@ for i in 1..(links.length)
|
|||
html += "<h1>#{title}</h1>"
|
||||
html += page.inner_html
|
||||
|
||||
url = links[i - 1]
|
||||
url = BASE + links[i - 1]
|
||||
|
||||
html += "<p>Visit <a href='#{url}'>tor.com</a> for discussion.</p>"
|
||||
end
|
||||
|
|
|
@ -140,7 +140,7 @@ for i in 1..(links.length)
|
|||
html += "<h1>#{title}</h1>"
|
||||
html += page.inner_html
|
||||
|
||||
url = links[i - 1]
|
||||
url = BASE + links[i - 1]
|
||||
|
||||
html += "<p>Visit <a href='#{url}'>tor.com</a> for discussion.</p>"
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue