From 056c3be3f2ab9a19d8b2c38396826aaad9d4081d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Wed, 30 Dec 2020 00:04:41 -0500 Subject: strip_non_ascii in comments-author-name --- youtube/util.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'youtube/util.py') diff --git a/youtube/util.py b/youtube/util.py index e92fed5..3d5546a 100644 --- a/youtube/util.py +++ b/youtube/util.py @@ -601,3 +601,9 @@ def to_valid_filename(name): name = '_' + name return name + + +def strip_non_ascii(string): + ''' Returns the string without non ASCII characters''' + stripped = (c for c in string if 0 < ord(c) < 127) + return ''.join(stripped) -- cgit v1.2.3