aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/extractor/common.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2021-11-23 13:11:28 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2021-11-23 13:14:06 +0530
commit8f122fa070dee737077059747731896a603c9e0b (patch)
treeb76531165e95320b9583dcfb7ee56519caebf263 /yt_dlp/extractor/common.py
parent14a086058a30a0748b5b716e9b21481f993518f3 (diff)
downloadhypervideo-pre-8f122fa070dee737077059747731896a603c9e0b.tar.lz
hypervideo-pre-8f122fa070dee737077059747731896a603c9e0b.tar.xz
hypervideo-pre-8f122fa070dee737077059747731896a603c9e0b.zip
[extractor] Extract `average_rating` from JSON-LD
Eg: Crunchyroll
Diffstat (limited to 'yt_dlp/extractor/common.py')
-rw-r--r--yt_dlp/extractor/common.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py
index 1565ba5c3..fc28bca2e 100644
--- a/yt_dlp/extractor/common.py
+++ b/yt_dlp/extractor/common.py
@@ -1452,6 +1452,9 @@ class InfoExtractor(object):
item_type = e.get('@type')
if expected_type is not None and expected_type != item_type:
continue
+ rating = traverse_obj(e, ('aggregateRating', 'ratingValue'), expected_type=float_or_none)
+ if rating is not None:
+ info['average_rating'] = rating
if item_type in ('TVEpisode', 'Episode'):
episode_name = unescapeHTML(e.get('name'))
info.update({