浏览代码

[youtube:channel] Support age restricted channels (fixes #7277)

Jaime Marquínez Ferrándiz 10 年之前
父节点
当前提交
5c43afd40f
共有 1 个文件被更改,包括 10 次插入1 次删除
  1. 10 1
      youtube_dl/extractor/youtube.py

+ 10 - 1
youtube_dl/extractor/youtube.py

@@ -1647,6 +1647,15 @@ class YoutubeChannelIE(YoutubePlaylistBaseInfoExtractor):
             'id': 'UUKfVa3S1e4PHvxWcwyMMg8w',
             'id': 'UUKfVa3S1e4PHvxWcwyMMg8w',
             'title': 'Uploads from lex will',
             'title': 'Uploads from lex will',
         }
         }
+    }, {
+        'note': 'Age restricted channel',
+        # from https://www.youtube.com/user/DeusExOfficial
+        'url': 'https://www.youtube.com/channel/UCs0ifCMCm1icqRbqhUINa0w',
+        'playlist_mincount': 64,
+        'info_dict': {
+            'id': 'UUs0ifCMCm1icqRbqhUINa0w',
+            'title': 'Uploads from Deus Ex',
+        },
     }]
     }]
 
 
     def _real_extract(self, url):
     def _real_extract(self, url):
@@ -1667,7 +1676,7 @@ class YoutubeChannelIE(YoutubePlaylistBaseInfoExtractor):
                 'channelId', channel_page, 'channel id', default=None)
                 'channelId', channel_page, 'channel id', default=None)
             if not channel_playlist_id:
             if not channel_playlist_id:
                 channel_playlist_id = self._search_regex(
                 channel_playlist_id = self._search_regex(
-                    r'data-channel-external-id="([^"]+)"',
+                    r'data-(?:channel-external-|yt)id="([^"]+)"',
                     channel_page, 'channel id', default=None)
                     channel_page, 'channel id', default=None)
         if channel_playlist_id and channel_playlist_id.startswith('UC'):
         if channel_playlist_id and channel_playlist_id.startswith('UC'):
             playlist_id = 'UU' + channel_playlist_id[2:]
             playlist_id = 'UU' + channel_playlist_id[2:]