mirror of
https://github.com/captn3m0/muse-dl.git
synced 2024-09-20 15:57:11 +00:00
Catch books with missing dates
This commit is contained in:
parent
0b241d6a47
commit
1a5086b2d7
3
.gitignore
vendored
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
|
||||
|
1914
spec/fixtures/book-57833.html
vendored
Normal file
1914
spec/fixtures/book-57833.html
vendored
Normal file
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…
Reference in New Issue
Block a user