chat-downloader
chat-downloader copied to clipboard
[BUG] Filename string after --output cannot begin with dash(-) due to mis-interpretated as option
Basic information
- Program version: 0.2.8
- Python version: Python 3.10.8
- Operating system: Windows 10 22H2
Describe the bug
Filename string after --output cannot begin with dash(-) due to mis-interpretated as option.
Command/Code used
If running from the command line, provide the following:
- The command used (including the verbose tag,
-v):
chat_downloader https://www.youtube.com/watch?v=-ZLltnPt5WM -o '-ZLltnPt5WM.json' -q
- Output from the above command:
usage: chat_downloader [-h] [--version] [--start_time START_TIME] [--end_time END_TIME]
[--message_types MESSAGE_TYPES | --message_groups MESSAGE_GROUPS] [--max_attempts MAX_ATTEMPTS]
[--retry_timeout RETRY_TIMEOUT] [--interruptible_retry [INTERRUPTIBLE_RETRY]]
[--max_messages MAX_MESSAGES] [--inactivity_timeout INACTIVITY_TIMEOUT] [--timeout TIMEOUT]
[--format FORMAT] [--format_file FORMAT_FILE] [--chat_type {live,top}] [--ignore IGNORE]
[--message_receive_timeout MESSAGE_RECEIVE_TIMEOUT] [--buffer_size BUFFER_SIZE]
[--output OUTPUT] [--overwrite [OVERWRITE]] [--sort_keys [SORT_KEYS]] [--indent INDENT]
[--pause_on_debug | --exit_on_debug]
[--logging {none,debug,info,warning,error,critical} | --testing | --verbose | --quiet]
[--cookies COOKIES] [--proxy PROXY]
url
chat_downloader: error: argument --output/-o: expected one argument
Expected behavior
silently exits (success)
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context/information
Add any other context or information about the problem here.
Can you try surrounding the arguments with double quotes? e.g.,
chat_downloader "https://www.youtube.com/watch?v=-ZLltnPt5WM" -o "-ZLltnPt5WM.json" -q
Forgot to mention, I'm using powershell. Neither single nor double quotes work. Only single quotes on windows command-line shell worked as expected.
PSVersionTable
Name Value
---- -----
PSVersion 7.3.10
PSEdition Core
GitCommitId 7.3.10
OS Microsoft Windows 10.0.19045
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
In that case, can you try:
- appending a space to the beginning of the video id:
' -ZLltnPt5WM.json' - escape the dash (I'm not sure how, perhaps
\?
In that case, can you try:
- appending a space to the beginning of the video id:
' -ZLltnPt5WM.json'
Adding space will result in a space in actual filename, but bypass this problem successfully. My version of Windows dosen't trim leading space in filenames perhaps.
- escape the dash (I'm not sure how, perhaps
\?
After test, '`-ZLltnPt5WM.json' will also result in a leading `, And other pattern "`-ZLltnPt5WM.json" will fail.
I think we're hitting a limitation in argparse... The best approach is probably to use one of the following alternatives instead:
--output=-ZLltnPt5WM.json-o=-ZLltnPt5WM-2.json