[bilibili] Add support for player.bilibili.com (closes #24402)
authorSergey M․ <dstftw@gmail.com>
Mon, 23 Mar 2020 17:24:39 +0000 (00:24 +0700)
committerSergey M․ <dstftw@gmail.com>
Mon, 23 Mar 2020 17:24:39 +0000 (00:24 +0700)
youtube_dl/extractor/bilibili.py
youtube_dl/extractor/extractors.py

index e9d0a8d0c04adab890e2061e0f3e1ec477cc0694..4dc597e160bcea4f0821719dc82e2908f20d1972 100644 (file)
@@ -434,3 +434,17 @@ class BilibiliAudioAlbumIE(BilibiliAudioBaseIE):
                     entries, am_id, album_title, album_data.get('intro'))
 
         return self.playlist_result(entries, am_id)
+
+
+class BiliBiliPlayerIE(InfoExtractor):
+    _VALID_URL = r'https?://player\.bilibili\.com/player\.html\?.*?\baid=(?P<id>\d+)'
+    _TEST = {
+        'url': 'http://player.bilibili.com/player.html?aid=92494333&cid=157926707&page=1',
+        'only_matching': True,
+    }
+
+    def _real_extract(self, url):
+        video_id = self._match_id(url)
+        return self.url_result(
+            'http://www.bilibili.tv/video/av%s/' % video_id,
+            ie=BiliBiliIE.ie_key(), video_id=video_id)
index 64d1fa2510cef6651c9da6582fab23e9522e8fa0..ef803b8a78d00544f4286f21d2c43acde751940b 100644 (file)
@@ -105,6 +105,7 @@ from .bilibili import (
     BiliBiliBangumiIE,
     BilibiliAudioIE,
     BilibiliAudioAlbumIE,
+    BiliBiliPlayerIE,
 )
 from .biobiochiletv import BioBioChileTVIE
 from .bitchute import (