diff --git a/src/fetch.cr b/src/fetch.cr index 94296f4..9a437de 100644 --- a/src/fetch.cr +++ b/src/fetch.cr @@ -25,6 +25,7 @@ module Muse::Dl return end + # TODO: Remove this hardcoding, and make this more generic by generating it within the Book class url = "https://muse.jhu.edu/chapter/#{chapter_id}/pdf" headers = HEADERS.merge({ "Referer" => "https://muse.jhu.edu/verify?url=%2Fchapter%2F#{chapter_id}%2Fpdf", diff --git a/src/muse-dl.cr b/src/muse-dl.cr index 25f30d4..75fdf3b 100644 --- a/src/muse-dl.cr +++ b/src/muse-dl.cr @@ -15,6 +15,10 @@ module Muse::Dl return unless thing if thing.is_a? Muse::Dl::Book + unless thing.formats.includes? :pdf + STDERR.puts "Book not available in PDF format, skipping: #{url}" + return + end # Will have no effect if parser has a custom title parser.output = Util.slug_filename "#{thing.title}.pdf"