commit e53e58f1f4f1687a27cc90800725f79168228cdc Author: fanyx Date: Sun Mar 14 15:21:35 2021 +0100 initial commit, completed diff --git a/dl.ps1 b/dl.ps1 new file mode 100644 index 0000000..ea11b75 --- /dev/null +++ b/dl.ps1 @@ -0,0 +1,102 @@ +param( + [parameter(mandatory=$true)] + [string]$seriesId, + [switch]$completeSeries, + [string]$seriesName, + [string]$outputFolder=(Resolve-Path .), + [int]$startChapter=1, + [int]$endChapter=$startChapter + +) + +### Init ### +$baseUrl = "https://www.mangareader.net" + +$usedVarsDownloadChapter = @("chapterNr", + "outputPath", + "chapterUrl", + "chapterBaseHtml", + "chapterPattern", + "chapterPages", + "chapterPage") + +$usedVarsForeachChapterPage = @("pageUrl", + "pageFormat", + "pageHtml") + +$usedVarsCurrentChapter = @("chapterFormat", + "chapterPath", + "ebookName") + +### Functions ### +Function DownloadChapter($chapterNr,$outputPath){ + $chapterUrl = "${seriesUrl}/${chapterNr}" + + $chapterBaseHtml = Invoke-WebRequest -UseBasicParsing -Uri $chapterUrl + + # Download first image, continue afterwards + Invoke-WebRequest -UseBasicParsing -Uri $chapterBaseHtml.Images.src -OutFile (Join-Path -Path $outputPath -ChildPath "01.jpg") #"${outputPath}\01.jpg" + + # evaluate regex + $chapterPattern = '(?<=