From 51a16937891ebb6d419ad21d0189182cb1197430 Mon Sep 17 00:00:00 2001 From: Astound Date: Mon, 22 Jan 2024 05:59:11 +0800 Subject: Fix comment count extraction due to 'K/M' postfixes YouTube now displays 2K comments instead of 2359, for instance --- youtube/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'youtube/__init__.py') diff --git a/youtube/__init__.py b/youtube/__init__.py index b0e8761..64aed56 100644 --- a/youtube/__init__.py +++ b/youtube/__init__.py @@ -54,7 +54,10 @@ def commatize(num): if num is None: return '' if isinstance(num, str): - num = int(num) + try: + num = int(num) + except ValueError: + return num return '{:,}'.format(num) -- cgit v1.2.3