summaryrefslogtreecommitdiffhomepage
path: root/youtube_dl/extractor/common.py
diff options
context:
space:
mode:
authorSergey M․ <[email protected]>2020-09-19 06:33:17 +0700
committerSergey M․ <[email protected]>2020-09-19 06:33:17 +0700
commitce5b904050b4610bac6d99673bbe9181a3af3db5 (patch)
tree677d4bbbd08f1af20b7e10103bdcf86b6cd01b68 /youtube_dl/extractor/common.py
parentad06b99dd47acc8b1bd213f079e1f36da9e3a73d (diff)
downloadyoutube-dl-ce5b904050b4610bac6d99673bbe9181a3af3db5.tar.gz
youtube-dl-ce5b904050b4610bac6d99673bbe9181a3af3db5.zip
[extractor/common] Relax interaction count extraction in _json_ld
Diffstat (limited to 'youtube_dl/extractor/common.py')
-rw-r--r--youtube_dl/extractor/common.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/youtube_dl/extractor/common.py b/youtube_dl/extractor/common.py
index c9b8b6337..021945a89 100644
--- a/youtube_dl/extractor/common.py
+++ b/youtube_dl/extractor/common.py
@@ -68,6 +68,7 @@ from ..utils import (
sanitized_Request,
sanitize_filename,
str_or_none,
+ str_to_int,
strip_or_none,
unescapeHTML,
unified_strdate,
@@ -1248,7 +1249,10 @@ class InfoExtractor(object):
interaction_type = is_e.get('interactionType')
if not isinstance(interaction_type, compat_str):
continue
- interaction_count = int_or_none(is_e.get('userInteractionCount'))
+ # For interaction count some sites provide string instead of
+ # an integer (as per spec) with non digit characters (e.g. ",")
+ # so extracting count with more relaxed str_to_int
+ interaction_count = str_to_int(is_e.get('userInteractionCount'))
if interaction_count is None:
continue
count_kind = INTERACTION_TYPE_MAP.get(interaction_type.split('/')[-1])