AlexAplin / nndownload

Download and process links from Niconico (nicovideo.jp)
MIT License
223 stars 29 forks source link

Special characters on video titles #61

Closed thgdorns closed 4 years ago

thgdorns commented 4 years ago

When using {title} on the file output, I get a 2544 error when the video title contains special characters. Could those be replaced with underscores?

AlexAplin commented 4 years ago

I need more context, including the command you ran, the output, and what potentially special characters you're talking about. I already try to sanitize filepaths for certain filesystems like Windows.

def sanitize_for_path(value, replace=' '):
    """Remove potentially illegal characters from a path."""

    return re.sub(r'[<>\"\?\\\/\*:]', replace, value)
thgdorns commented 4 years ago

nndownload.exe -u username -p password -o "{uploader} - {id} - {title}.{ext}" https://www.nicovideo.jp/watch/sm35868592

Logging in... Logged in. Performing initial API request... Performed initial API request. Downloading sm35868592 to "けの人 - sm35868592 - 【東方MMD】PiNK CAT | ピンクキャット 【十六夜 咲夜】.mp4"... Traceback (most recent call last): File "nndownload\nndownload.py", line 1337, in File "nndownload\nndownload.py", line 1325, in main File "nndownload\nndownload.py", line 1291, in process_url_mo File "nndownload\nndownload.py", line 644, in request_video File "nndownload\nndownload.py", line 864, in download_video OSError: [Errno 22] Invalid argument: 'けの人 - sm35868592 - 【東方MMD】PiNK CAT | ピンクキャット 【十六夜 咲夜】.mp4' [3980] Failed to execute script nndownload