Răsfoiți Sursa

[added] Better error message when the download URL for supported formats can't be found. It will help to debug #1.

TnS-hun 6 ani în urmă
părinte
comite
a391363320
1 a modificat fișierele cu 6 adăugiri și 1 ștergeri
  1. 6 1
      kobo-book-downloader/Kobo.py

+ 6 - 1
kobo-book-downloader/Kobo.py

@@ -275,7 +275,12 @@ class Kobo:
 				hasDrm = jsonContentUrl[ "DRMType" ] == "KDRM"
 				return jsonContentUrl[ "DownloadUrl" ], hasDrm
 
-		raise KoboException( "Download URL for supported formats can't be found for product '%s'." % productId )
+		message = "Download URL for supported formats can't be found for product '%s'.\n" % productId
+		message += "Available formats:"
+		for jsonContentUrl in jsonContentUrls:
+			message += "\nDRMType: '%s', UrlFormat: '%s'" % ( jsonContentUrl[ "DRMType" ], jsonContentUrl[ "UrlFormat" ] )
+
+		raise KoboException( message )
 
 	def __DownloadToFile( self, url, outputPath: str ) -> None:
 		response = self.Session.get( url, stream = True )