Catch books with missing dates

This commit is contained in:
Nemo 2020-04-04 01:10:11 +05:30
parent 0b241d6a47
commit 1a5086b2d7
5 changed files with 1928 additions and 3 deletions

1
.gitignore vendored
View File

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

View File

@ -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

1914
spec/fixtures/book-57833.html vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -39,7 +39,11 @@ module Muse::Dl
end
def self.date(myhtml : Myhtml::Parser)
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)

View File

@ -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