Catch books with missing dates

pull/7/head
Nemo 3 years ago
parent 0b241d6a47
commit 1a5086b2d7
  1. 3
      .gitignore
  2. 6
      spec/book_spec.cr
  3. 1914
      spec/fixtures/book-57833.html
  4. 6
      src/infoparser.cr
  5. 2
      src/thing.cr

3
.gitignore vendored

@ -4,4 +4,5 @@
/.shards/
*.dwarf
*.pdf
*.o
*.o
muse-dl-static*

@ -72,4 +72,10 @@ describe Muse::Dl::Book do
book.formats.should contain :pdf
book.formats.should contain :html
end
it "should note both formats for book/57833" do
html = File.new("spec/fixtures/book-57833.html").gets_to_end
book = Muse::Dl::Book.new html
book.formats.should contain :pdf
end
end

File diff suppressed because it is too large Load Diff

@ -39,7 +39,11 @@ module Muse::Dl
end
def self.date(myhtml : Myhtml::Parser)
myhtml.css("#book_about_info .date").map(&.inner_text).to_a[0].strip
begin
myhtml.css("#book_about_info .date").map(&.inner_text).to_a[0].strip
rescue e : Exception
nil
end
end
def self.publisher(myhtml : Myhtml::Parser)

@ -6,7 +6,7 @@ module Muse::Dl
@info = Hash(String, String).new
@title : String
@author : String
@date : String
@date : String | Nil
@publisher : String
@summary : String
@summary_html : String

Loading…
Cancel
Save