]> jfr.im git - yt-dlp.git/commitdiff
[youtube] Added 'subscriber_count' to extraction
authorJoel Potts <redacted>
Tue, 15 Sep 2020 15:16:58 +0000 (17:16 +0200)
committerJoel Potts <redacted>
Mon, 21 Sep 2020 09:56:51 +0000 (11:56 +0200)
youtube_dl/extractor/youtube.py

index 02f3ab61aef7be11e68f7f16985823b9d908e70e..f0d2a8873c2173b4ebf9b352f4a59ce58656a503 100644 (file)
@@ -39,6 +39,7 @@
     mimetype2ext,
     orderedSet,
     parse_codecs,
+    parse_count,
     parse_duration,
     remove_quotes,
     remove_start,
@@ -2421,6 +2422,14 @@ def _extract_count(count_name):
             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):
@@ -2558,6 +2567,7 @@ def decrypt_sig(mobj):
             'album': album,
             'release_date': release_date,
             'release_year': release_year,
+            'subscriber_count': subscriber_count,
         }