L4cache / kemono-dl

(personal fork of) A simple kemono.party downloader using python.
95 stars 14 forks source link

Hard code arguments #3

Closed ghost closed 1 year ago

ghost commented 2 years ago

Sorry to bother you I have a lengthy command line argument like 'python kemono-dl.py --cookies "cookie.txt" --dirname-pattern "Downloads{username}" --filename-pattern "{title}{index}{filename}.{ext}" --inline-filename-pattern "{title}{index}{filename}.{ext}" --other-filename-pattern "{title}{index}{filename}.{ext}" --user-filename-pattern "{title}{index}{filename}.{ext}" --links "example.com"' how would i go about hard coding this into the program. I have tried changing the default parameter for cookie argument but it creates problems. And another related question I would like the program to run automatically with these arguments and add something like input("enter link: ") instead of the link argument. Is that possible and where would I need to edit? I would really appreciate it if you could help. Thanks.

L4cache commented 2 years ago

sorry, I know little about the entire structure of this script, but I do have same need like you, I just simply made a batch file for it.

set /p links=links: 
cd /d C:\Users\L4\CLIs\kemono-dl-main\
kemono-dl.py --cookies cookies.txt --content --comments --json --links %links%
pause

some thing like that

ghost commented 2 years ago

Thank you very much. Batch files didn't even come to my mind. Good enough for now. I'll let you know if I find a permanent solution. Thanks.

Taithrah commented 1 year ago

I was checking for updates and noticed this Issue. This may not fix your issue but I noticed batch files being brought up and figured I would share mine for anyone who might be interested.

Please feel free to improve it or change anything I did that may be wrong. It's been great for my needs. I added comments for anyone who needs them.

@echo off
setlocal

REM Updates
git pull
git submodule init
git submodule update

REM Ask for user input and stores variables for later.
set cookie=cookie.txt
set /p url=Enter URL:

REM Checks if a virtual environment exists. If so continue. If not, then create one and install requirements.
if not exist "venv" (
    python -m venv venv
    call .\venv\Scripts\activate.bat
    pip install -r requirements.txt
) else (
    call .\venv\Scripts\activate.bat
)

REM Runs the python script with arguments.
.\venv\Scripts\python.exe kemono-dl.py --cookies %cookie% --links %url%

endlocal
ghost commented 1 year ago

The first response worked great for me and fixed my issue. Thanks a lot.