used the proper filename sanitizer

As reported by KajeArch on GitHub on issue #3
(https://github.com/swolegoal/squid-dl/issues/3), I was not correctly
handling playlists named with characters invalid for a file path.  As
it turns out, I was using the wrong helper function from yt_dlp.utils.

I changed all the calls from sanitize_path(), a function made to clean
up Windows paths to the more fully-featured sanitize_filename().  If any
Windows users notice any bad behavior after this change, please feel
free to make a ticket at:
  https://github.com/swolegoal/squid-dl/issues/new/choose
This commit is contained in:
Andrea Rogers 2022-08-22 18:17:27 -05:00
commit 7ab21cccb2
2 changed files with 5 additions and 5 deletions

View file

@ -2,7 +2,7 @@
import argparse
import json as j
from yt_dlp import YoutubeDL
from yt_dlp.utils import encodeFilename, sanitize_path
from yt_dlp.utils import encodeFilename, sanitize_filename
"""
Dump yt_dlp's entire info_dict for a whole playlist in JSON format.
@ -43,7 +43,7 @@ if __name__ == "__main__":
y.extract_info(opts.playlist_url, download=False)
)
dump_path = encodeFilename(sanitize_path(info_dict["title"] + ".json"))
dump_path = encodeFilename(sanitize_filename(info_dict["title"] + ".json"))
print(
'[INFO]: Writing JSON-ified playlist info_dict to "{}"'.format(
dump_path