aboutsummaryrefslogtreecommitdiffstats
path: root/youtube_dlc/extractor/youtube.py
diff options
context:
space:
mode:
Diffstat (limited to 'youtube_dlc/extractor/youtube.py')
-rw-r--r--youtube_dlc/extractor/youtube.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/youtube_dlc/extractor/youtube.py b/youtube_dlc/extractor/youtube.py
index 293d6069d..e68395583 100644
--- a/youtube_dlc/extractor/youtube.py
+++ b/youtube_dlc/extractor/youtube.py
@@ -39,6 +39,7 @@ from ..utils import (
mimetype2ext,
orderedSet,
parse_codecs,
+ parse_count,
parse_duration,
remove_quotes,
remove_start,
@@ -2455,7 +2456,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
def _extract_count(count_name):
return str_to_int(self._search_regex(
- r'-%s-button[^>]+><span[^>]+class="yt-uix-button-content"[^>]*>([\d,]+)</span>'
+ r'"accessibilityData":\{"label":"([\d,\w]+) %ss"\}'
% re.escape(count_name),
video_webpage, count_name, default=None))
@@ -2484,6 +2485,14 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
video_duration = parse_duration(self._html_search_meta(
'duration', video_webpage, 'video duration'))
+ # Get Subscriber Count of channel
+ subscriber_count = parse_count(self._search_regex(
+ r'"text":"([\d\.]+\w?) subscribers"',
+ video_webpage,
+ 'subscriber count',
+ default=None
+ ))
+
# annotations
video_annotations = None
if self._downloader.params.get('writeannotations', False):
@@ -2621,6 +2630,7 @@ class YoutubeIE(YoutubeBaseInfoExtractor):
'album': album,
'release_date': release_date,
'release_year': release_year,
+ 'subscriber_count': subscriber_count,
}