mirror of https://github.com/captn3m0/muse-dl.git
Catch books with missing dates
This commit is contained in:
parent
0b241d6a47
commit
1a5086b2d7
|
@ -4,4 +4,5 @@
|
||||||
/.shards/
|
/.shards/
|
||||||
*.dwarf
|
*.dwarf
|
||||||
*.pdf
|
*.pdf
|
||||||
*.o
|
*.o
|
||||||
|
muse-dl-static*
|
|
@ -72,4 +72,10 @@ describe Muse::Dl::Book do
|
||||||
book.formats.should contain :pdf
|
book.formats.should contain :pdf
|
||||||
book.formats.should contain :html
|
book.formats.should contain :html
|
||||||
end
|
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
|
end
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -39,7 +39,11 @@ module Muse::Dl
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.date(myhtml : Myhtml::Parser)
|
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
|
end
|
||||||
|
|
||||||
def self.publisher(myhtml : Myhtml::Parser)
|
def self.publisher(myhtml : Myhtml::Parser)
|
||||||
|
|
|
@ -6,7 +6,7 @@ module Muse::Dl
|
||||||
@info = Hash(String, String).new
|
@info = Hash(String, String).new
|
||||||
@title : String
|
@title : String
|
||||||
@author : String
|
@author : String
|
||||||
@date : String
|
@date : String | Nil
|
||||||
@publisher : String
|
@publisher : String
|
||||||
@summary : String
|
@summary : String
|
||||||
@summary_html : String
|
@summary_html : String
|
||||||
|
|
Loading…
Reference in New Issue