From abcdd12b26762c101e79f739557d4fbb1d83cc56 Mon Sep 17 00:00:00 2001
From: pukkandan <pukkandan.ytdlp@gmail.com>
Date: Mon, 17 May 2021 18:37:58 +0530
Subject: [PATCH] [youtube:tab] Support youtube music `MP` pages

---
 yt_dlp/extractor/youtube.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/yt_dlp/extractor/youtube.py b/yt_dlp/extractor/youtube.py
index de1798ef0..1d50264b6 100644
--- a/yt_dlp/extractor/youtube.py
+++ b/yt_dlp/extractor/youtube.py
@@ -2926,6 +2926,14 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor):
             'Falling back to channel URL',
         ],
         'playlist_mincount': 9,
+    }, {
+        'note': 'Youtube music Album',
+        'url': 'https://music.youtube.com/browse/MPREb_gTAcphH99wE',
+        'info_dict': {
+            'id': 'OLAK5uy_l1m0thk3g31NmIIz_vMIbWtyv7eZixlH0',
+            'title': 'Album - Royalty Free Music Library V2 (50 Songs)',
+        },
+        'playlist_count': 50,
     }]
 
     @classmethod
@@ -3633,6 +3641,13 @@ class YoutubeTabIE(YoutubeBaseInfoExtractor):
                     # Youtube music VL channels have an equivalent playlist
                     item_id = item_id[2:]
                     pre, tab, post, is_channel = 'https://www.youtube.com/playlist?list=%s' % item_id, '', '', False
+                elif item_id[:2] == 'MP':
+                    # Youtube music albums (/channel/MP...) have a OLAK playlist that can be extracted from the webpage
+                    item_id = self._search_regex(
+                        r'\\x22audioPlaylistId\\x22:\\x22([0-9A-Za-z_-]+)\\x22',
+                        self._download_webpage('https://music.youtube.com/channel/%s' % item_id, item_id),
+                        'playlist id')
+                    pre, tab, post, is_channel = 'https://www.youtube.com/playlist?list=%s' % item_id, '', '', False
                 elif mobj['channel_type'] == 'browse':
                     # Youtube music /browse/ should be changed to /channel/
                     pre = 'https://www.youtube.com/channel/%s' % item_id