I don't know if it's supposed to be like this, but I can't use URLs formatted in https://www.royalroadl.com/fiction/XXXX/title
So I created a batch that should work with all URLs.
(P.S There's another batch under this one, but it's a pathetic version of the first batch)
These are both majorly flawed, but they should work for most books, and the first one should work for all books, including pasting in chapter URLs, and chapter URLs with the "d%C3%A9j%C3%A0-vu".
@SETLOCAL enableextensions enabledelayedexpansion
@echo off
rem "Edit Information Here"
set programVersion="1.2.5"
set allocateMemorySize="1024"
rem "For Memory Size, 1024 is 1G, 2048 is 2G, etc."
rem "Above 1G will not work on all computers"
rem "Don't Edit Beyond This"
set /p bookURL="Enter RoyalRoadL Book URL: "
call:extractLeadingNumbers %bookURL% bookURLnumber
set bookURLparsed="https://www.royalroadl.com/fiction/%bookURLnumber%"
java -Xmx%allocateMemorySize%m -Xms%allocateMemorySize%m -jar royalroadl-downloader-assembly-%programVersion%.jar %bookURLparsed%
pause
:extractLeadingNumbers inputString returnVar
setlocal enableextensions disabledelayedexpansion
set "string=%~1"
for /f "tokens=1-2 delims=0123456789 " %%a in ("%string:^"=%") do set "delimiters=%%a%%b"
for /f "delims=%delimiters% " %%a in ("%string:^"=%") do set "numbers=%%a"
endlocal & set "%~2=%numbers%"
goto :eof
endlocal
aaaaaaand one that works with books with four digit book titles
@SETLOCAL enableextensions enabledelayedexpansion
@echo off
rem "Edit Information Here"
set programVersion="1.2.5"
set allocateMemorySize="1024"
rem "For Memory Size, 1024 is 1G, 2048 is 2G, etc."
rem "Above 1G will not work on all computers"
rem "Don't Edit Beyond This"
set /p bookURL="Enter RoyalRoadL Book URL: "
if not x%bookURL:https:=%==x%bookURL% if not x%bookURL:www.=%==x%bookURL% call:httpsWWW
if not x%bookURL:https:=%==x%bookURL% if x%bookURL:www.=%==x%bookURL% call:httpsnoWWW
if not x%bookURL:http:=%==x%bookURL% if not x%bookURL:www.=%==x%bookURL% call:httpWWW
if not x%bookURL:http:=%==x%bookURL% if x%bookURL:www.=%==x%bookURL% call:httpnoWWW
java -Xmx%allocateMemorySize%m -Xms%allocateMemorySize%m -jar royalroadl-downloader-assembly-%programVersion%.jar %bookURLparsed%
pause
:httpsWWW
set bookURLparsed=%bookURL:~0,39%
goto:eof
:httpsnoWWW
set bookURLparsed=%bookURL:~0,36%
goto:eof
:httpWWW
set bookURLparsed=%bookURL:~0,38%
goto:eof
:httpnoWWW
set bookURLparsed=%bookURL:~0,35%
goto:eof
endlocal