mirror of https://github.com/captn3m0/muse-dl.git
Skip books that don't support PDF
This commit is contained in:
parent
2a78be1022
commit
f3c757984a
|
@ -25,6 +25,7 @@ module Muse::Dl
|
||||||
return
|
return
|
||||||
end
|
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"
|
url = "https://muse.jhu.edu/chapter/#{chapter_id}/pdf"
|
||||||
headers = HEADERS.merge({
|
headers = HEADERS.merge({
|
||||||
"Referer" => "https://muse.jhu.edu/verify?url=%2Fchapter%2F#{chapter_id}%2Fpdf",
|
"Referer" => "https://muse.jhu.edu/verify?url=%2Fchapter%2F#{chapter_id}%2Fpdf",
|
||||||
|
|
|
@ -15,6 +15,10 @@ module Muse::Dl
|
||||||
return unless thing
|
return unless thing
|
||||||
|
|
||||||
if thing.is_a? Muse::Dl::Book
|
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
|
# Will have no effect if parser has a custom title
|
||||||
parser.output = Util.slug_filename "#{thing.title}.pdf"
|
parser.output = Util.slug_filename "#{thing.title}.pdf"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue