diff options
author | James Taylor <user234683@users.noreply.github.com> | 2020-03-08 16:17:04 -0700 |
---|---|---|
committer | James Taylor <user234683@users.noreply.github.com> | 2020-03-08 16:17:04 -0700 |
commit | 56e7751da7f8bb8b8108871ce46e50310dc73a9f (patch) | |
tree | 39d773c0f8640b306a368c4ca0ea4f04f3ceda75 /youtube/util.py | |
parent | fa112592fa306f5d75ce94d840969835f2d02302 (diff) | |
download | yt-local-56e7751da7f8bb8b8108871ce46e50310dc73a9f.tar.lz yt-local-56e7751da7f8bb8b8108871ce46e50310dc73a9f.tar.xz yt-local-56e7751da7f8bb8b8108871ce46e50310dc73a9f.zip |
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).
Diffstat (limited to 'youtube/util.py')
-rw-r--r-- | youtube/util.py | 9 |
1 files changed, 9 insertions, 0 deletions
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: |