From 56e7751da7f8bb8b8108871ce46e50310dc73a9f Mon Sep 17 00:00:00 2001 From: James Taylor Date: Sun, 8 Mar 2020 16:17:04 -0700 Subject: Fix failure to parse comments when there's one from deleted channel Specifically, fix failures when any of the fields from the parsed comment are None, such as author, author_url, etc. (failure due to string concatenation when building urls). --- youtube/util.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'youtube/util.py') diff --git a/youtube/util.py b/youtube/util.py index a70bd7e..ec25d40 100644 --- a/youtube/util.py +++ b/youtube/util.py @@ -357,6 +357,15 @@ def left_remove(string, substring): return string[len(substring):] return string +def concat_or_none(*strings): + '''Concatenates strings. Returns None if any of the arguments are None''' + result = '' + for string in strings: + if string is None: + return None + result += string + return result + def prefix_urls(item): try: -- cgit v1.2.3