Adds oathbringer reread

This commit is contained in:
Nemo 2018-07-27 00:38:56 +05:30
parent b88fe8e0e8
commit 442956ff37
8 changed files with 122 additions and 7 deletions

2
.gitignore vendored
View File

@ -3,4 +3,6 @@
/oathbringer/*.html
/wok-prime/*.html
/edgedancer/*.html
/oathbringer-reread/*.html
/books/*
vendor

5
Gemfile Normal file
View File

@ -0,0 +1,5 @@
# frozen_string_literal: true
source "https://rubygems.org"
gem 'nokogiri'
gem 'paru'

17
Gemfile.lock Normal file
View File

@ -0,0 +1,17 @@
GEM
remote: https://rubygems.org/
specs:
mini_portile2 (2.3.0)
nokogiri (1.8.4)
mini_portile2 (~> 2.3.0)
paru (0.3.0.1)
PLATFORMS
ruby
DEPENDENCIES
nokogiri
paru
BUNDLED WITH
1.16.3

View File

@ -4,11 +4,12 @@
Scripts to generate books from the [Cosmere]() using various public sources. Currently supports the following books:
1. Oathbringer (Serialized till Chapter 32)
2. Way of Kings Reread
3. Words of Radiance Reread
4. Edgedancer Reread
5. Way of Kings Prime
1. Oathbringer (Serialized till Chapter 32)
2. Way of Kings Reread
3. Words of Radiance Reread
4. Edgedancer Reread
5. Way of Kings Prime
6. Oathbringer Reread
For obvious reasons, the converted ebooks are not part of this repo. You must download
and run the script on your own machine to generate the copies.
@ -45,12 +46,18 @@ More details at https://www.tor.com/series/edgedancer-reread-brandon-sanderson/
## Way of Kings: Prime
>For it([Altered Perceptions anthology](https://www.indiegogo.com/projects/altered-perceptions)), Im letting people see—for the first time—a large chunk of the original version of The Way of Kings, which I wrote in 20022003. This version is very different, and involves a different course in life for Kaladin as a character—all due to a simple decision he makes one way in this book, but a completely different way in the published novel.
> For it([Altered Perceptions anthology](https://www.indiegogo.com/projects/altered-perceptions)), Im letting people see—for the first time—a large chunk of the original version of The Way of Kings, which I wrote in 20022003. This version is very different, and involves a different course in life for Kaladin as a character—all due to a simple decision he makes one way in this book, but a completely different way in the published novel.
>These chapters are quite fun, as I consider what happened in The Way of Kings Prime (as I now call it) to be an "alternate reality" version of the events in the published books. The characters are almost all exactly the same people, but their backstories are different, and that has transformed who they are and how they react to the world around them. Roshar is similar, yet wildly different, as this was before I brought in the spren as a major world element.
> These chapters are quite fun, as I consider what happened in The Way of Kings Prime (as I now call it) to be an "alternate reality" version of the events in the published books. The characters are almost all exactly the same people, but their backstories are different, and that has transformed who they are and how they react to the world around them. Roshar is similar, yet wildly different, as this was before I brought in the spren as a major world element.
You can read more at the announcement at [BrandonSanderson.com](https://brandonsanderson.com/chapters-from-the-original-draft-of-the-way-of-kings-available-in-anthology-to-benefit-robison-wells/)
# Oathbringer Reread
> Join Alice Arneson and Lyndsey Luther for a reread of Brandon Sandersons Oathbringer, the third novel in the Stormlight Archive epic fantasy series.
More details at https://www.tor.com/series/oathbringer-reread-brandon-sanderson/
## Requirements
- Ruby
@ -106,6 +113,12 @@ All the generated files will be saved with the filename `books/edgedancer-reread
All the generated files will be saved with the filename `books/wok-prime.{epub|pdf|mobi|html}`. This generation might take a while the script attempts to strip out unnecessary HTML.
## Oathbringer Reread
ruby oathbringer-reread.rb
All the generated files will be saved with the filename `books/oathbringer-reread.{epub|pdf|mobi|html}`. This generation might take a while the script attempts to strip out unnecessary HTML.
## Extra
If you'd like to see any other books covered here, please create an issue, or reach out to me: <https://captnemo.in/contact/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

View File

@ -0,0 +1,5 @@
<dc:title id="epub-title-1">Oathbringer Reread</dc:title>
<dc:date>2018-07-26</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>

73
oathbringer-reread.rb Normal file
View File

@ -0,0 +1,73 @@
require 'date'
require 'fileutils'
require 'nokogiri'
require_relative './methods'
FileUtils.mkdir_p('oathbringer-reread')
BASE = 'https://www.tor.com'.freeze
links = [
"/2018/01/25/introducing-the-oathbringer-reread/",
"/2018/02/01/oathbringer-reread-prologue/",
"/2018/02/08/oathbringer-reread-chapter-one/",
"/2018/02/15/oathbringer-reread-chapter-two/",
"/2018/02/22/oathbringer-reread-chapter-three/",
"/2018/03/01/oathbringer-reread-chapter-four/",
"/2018/03/08/oathbringer-reread-chapters-five-and-six/",
"/2018/03/15/oathbringer-reread-chapter-seven/",
"/2018/03/22/oathbringer-reread-chapters-eight-and-nine/",
"/2018/03/29/oathbringer-reread-chapter-ten/",
"/2018/04/05/oathbringer-reread-chapter-eleven/",
"/2018/04/12/oathbringer-reread-chapter-12/",
"/2018/04/19/oathbringer-reread-chapter-thirteen/",
"/2018/04/26/oathbringer-reread-chapters-fourteen-and-fifteen/",
"/2018/05/03/oathbringer-reread-chapter-16/",
"/2018/05/10/oathbringer-reread-chapter-seventeen/",
"/2018/05/17/oathbringer-reread-chapter-eighteen/",
"/2018/05/24/oathbringer-reread-chapters-19-and-20-brandon-sanderson/",
"/2018/05/31/oathbringer-reread-chapters-twenty-one-and-twenty-two/",
"/2018/06/07/oathbringer-reread-chapters-twenty-three-and-twenty-four/",
"/2018/06/14/oathbringer-reread-chapter-twenty-five/",
"/2018/06/21/oathbringer-reread-chapters-twenty-six-and-twenty-seven/",
"/2018/06/28/oathbringer-reread-chapter-twenty-eight/",
"/2018/07/05/oathbringer-reread-chapters-twenty-nine-and-thirty/",
"/2018/07/12/oathbringer-reread-chapters-thirty-one-and-thirty-two/",
"/2018/07/19/oathbringer-reread-interludes-one-two-and-three/",
"/2018/07/26/oathbringer-reread-chapter-thirty-three/"
]
episode = 1
links.each do |link|
url = BASE + link
puts "Download #{url}"
unless File.exist? "wor/#{episode}.html"
`wget --no-clobber "#{url}" --output-document "oathbringer-reread/#{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("oathbringer-reread/#{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.class?('post-end-spacer')
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/oathbringer-reread.html', 'w') { |file| file.write(html) }
puts '[html] Generated HTML file'
generate('oathbringer-reread', :all)